From fe6df1c222875a28ad32ea1b87740227ddc99de5 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Wed, 24 Oct 2018 23:29:43 +0000 Subject: [PATCH] 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. --- zerver/data_import/hipchat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zerver/data_import/hipchat.py b/zerver/data_import/hipchat.py index fda83eb1a9..b88b8e0a8f 100755 --- a/zerver/data_import/hipchat.py +++ b/zerver/data_import/hipchat.py @@ -626,8 +626,8 @@ def make_user_messages(zerver_message: List[ZerverFieldsT], recipient_id = message['recipient'] sender_id = message['sender'] mention_user_ids = mention_map[message_id] - user_ids = subscriber_map.get(recipient_id, set()) - user_ids.add(sender_id) + subscriber_ids = subscriber_map.get(recipient_id, set()) + user_ids = subscriber_ids | {sender_id} for user_id in user_ids: is_mentioned = user_id in mention_user_ids