hipchat import: Fix bug w/rogue UserMessage records.

This bug was introduced very recently and is an
aliasing bug.  It caused extra UserMessage rows to
be created as we inadvertently updated the underlying
subscriber_map sets for multiple messages.

This probably mostly affected PMs.

It's doubtful the bug ever got out into the field.
This commit is contained in:
Steve Howell 2018-10-24 23:29:43 +00:00 committed by showell
parent 9b0265452f
commit fe6df1c222
1 changed files with 2 additions and 2 deletions

View File

@ -626,8 +626,8 @@ def make_user_messages(zerver_message: List[ZerverFieldsT],
recipient_id = message['recipient'] recipient_id = message['recipient']
sender_id = message['sender'] sender_id = message['sender']
mention_user_ids = mention_map[message_id] mention_user_ids = mention_map[message_id]
user_ids = subscriber_map.get(recipient_id, set()) subscriber_ids = subscriber_map.get(recipient_id, set())
user_ids.add(sender_id) user_ids = subscriber_ids | {sender_id}
for user_id in user_ids: for user_id in user_ids:
is_mentioned = user_id in mention_user_ids is_mentioned = user_id in mention_user_ids