From d98a5925cbd6b149e55bfdeab2a27331bb18f3f9 Mon Sep 17 00:00:00 2001 From: Rhea Parekh Date: Sat, 18 Aug 2018 00:05:00 +0530 Subject: [PATCH] import: Build Reaction with the model class. --- zerver/data_import/slack.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/zerver/data_import/slack.py b/zerver/data_import/slack.py index 466e97a5a7..559d9e89b6 100755 --- a/zerver/data_import/slack.py +++ b/zerver/data_import/slack.py @@ -689,15 +689,19 @@ def build_reactions(reaction_list: List[ZerverFieldsT], reactions: List[ZerverFi continue for user in slack_reaction['users']: - reaction = dict( + reaction = Reaction( id=reaction_id, emoji_code=emoji_code, emoji_name=emoji_name, - message=message_id, - reaction_type=reaction_type, - user_profile=added_users[user]) + reaction_type=reaction_type) + + reaction_dict = model_to_dict(reaction, + exclude=['message', 'user_profile']) + reaction_dict['message'] = message_id + reaction_dict['user_profile'] = added_users[user] + reaction_id += 1 - reaction_list.append(reaction) + reaction_list.append(reaction_dict) return reaction_id def build_uploads(user_id: int, realm_id: int, email: str, fileinfo: ZerverFieldsT, s3_path: str,