From: Alex Schroeder Date: Wed, 14 Aug 2019 10:40:46 +0000 (+0200) Subject: Remove the comment from the post after undo X-Git-Url: https://vcs.fsf.org/?p=jan-pona-mute.git;a=commitdiff_plain;h=b5d7f34ea6584ca8d5c97fdd68a4a4a550ca4f1e Remove the comment from the post after undo 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. --- diff --git a/jan-pona-mute.py b/jan-pona-mute.py index dfe13cd..332cf17 100755 --- a/jan-pona-mute.py +++ b/jan-pona-mute.py @@ -427,13 +427,16 @@ Use the 'edit' command to edit notes.""" 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])