From 1cc2764d4560a7678ecc8f089c9aaab7d2a9c16c Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 29 Jun 2022 15:42:05 +0200 Subject: [PATCH] rocketchat: Ignore reactions from non-existant users. Not sure where those come from since we discovered this with production data. Somehow there were reactions with usernames that were old and no longer existed. Signed-off-by: Florian Pritz --- zerver/data_import/rocketchat.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zerver/data_import/rocketchat.py b/zerver/data_import/rocketchat.py index d414e4a9b1..21a45fd6f2 100644 --- a/zerver/data_import/rocketchat.py +++ b/zerver/data_import/rocketchat.py @@ -634,6 +634,11 @@ def process_messages( usernames = reactions[react_code]["usernames"] for username in usernames: + if username not in username_to_user_id_map: # nocoverage + # This can happen with production data when old user names no longer exist. We cannot do + # much about it here so we just ignore the unknown user name. + continue + rc_user_id = username_to_user_id_map[username] user_id = user_id_mapper.get(rc_user_id) reactions_list.append({"name": name, "user_id": user_id})