From f388b863062565d9889ae07c5beebe5a52d3ded9 Mon Sep 17 00:00:00 2001 From: Deimos Date: Wed, 8 Aug 2018 02:04:28 -0600 Subject: [PATCH] Skip deleted/removed comments in mentions consumer --- tildes/consumers/comment_user_mentions_generator.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tildes/consumers/comment_user_mentions_generator.py b/tildes/consumers/comment_user_mentions_generator.py index dea5c0f..265bde8 100644 --- a/tildes/consumers/comment_user_mentions_generator.py +++ b/tildes/consumers/comment_user_mentions_generator.py @@ -16,6 +16,11 @@ class CommentUserMentionGenerator(PgsqlQueueConsumer): .filter_by(comment_id=msg.body['comment_id']) .one() ) + + # don't generate mentions for deleted/removed comments + if comment.is_deleted or comment.is_removed: + return + new_mentions = CommentNotification.get_mentions_for_comment( self.db_session, comment)