Update mentioned flags after message edits.

(imported from commit 67886db571193a0f53cf72aa00af9e5e75729dc0)
This commit is contained in:
Steve Howell 2014-01-07 13:40:02 -05:00 committed by Waseem Daher
parent 997eb82f85
commit 3e48b4fd95
1 changed files with 7 additions and 0 deletions

View File

@ -1514,6 +1514,8 @@ def truncate_topic(topic):
def update_user_message_flags(message, ums):
wildcard = message.mentions_wildcard
mentioned_ids = message.mentions_user_ids
ids_with_alert_words = message.user_ids_with_alert_words
changed_ums = set()
@ -1531,6 +1533,11 @@ def update_user_message_flags(message, ums):
has_alert_word = um.user_profile_id in ids_with_alert_words
update_flag(um, has_alert_word, UserMessage.flags.has_alert_word)
mentioned = um.user_profile_id in mentioned_ids
update_flag(um, mentioned, UserMessage.flags.mentioned)
update_flag(um, wildcard, UserMessage.flags.wildcard_mentioned)
for um in changed_ums:
um.save(update_fields=['flags'])