The undo case (delete comment x from y) is now handled like the normal
case (delete comment z) in that we update the comments of the post
such as to remove the deleted comment. This fixes the display using
the comments command.
words = line.strip().split()
if words:
if words[0] == "comment":
- if self.post == None:
- print("Use the 'show' command to show a post, first.")
- return
if len(words) == 4:
- self.post_cache[words[3]].delete_comment(words[1])
+ post = self.post_cache[words[3]]
+ post.delete_comment(words[1])
+ comments = [c.id for c in post.comments if c.id != id]
+ post.comments = diaspy.models.Comments(comments)
print("Comment deleted.")
return
+ if self.post == None:
+ print("Use the 'show' command to show a post, first.")
+ return
if len(words) == 2:
try:
n = int(words[1])