From 455acb8e3b030fa86a6fd89dde803a4b703bfc91 Mon Sep 17 00:00:00 2001
From: Rhea Parekh <rheaparekh12@gmail.com>
Date: Thu, 30 Nov 2017 15:55:25 +0530
Subject: [PATCH] slack: Make minor fixes in zerver_userprofile and
zerver_realm mappings.
---
zulip/integrations/slack/slackdata2zulipdata.py | 13 ++++++++++---
zulip/integrations/slack/zerver_realm_skeleton.json | 2 +-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/zulip/integrations/slack/slackdata2zulipdata.py b/zulip/integrations/slack/slackdata2zulipdata.py
index 766fa72c..0459167c 100755
--- a/zulip/integrations/slack/slackdata2zulipdata.py
+++ b/zulip/integrations/slack/slackdata2zulipdata.py
@@ -59,6 +59,12 @@ def users2zerver_userprofile(slack_dir: str, realm_id: int, timestamp: Any,
if timezone is None or '/' not in timezone:
timezone = _default_timezone
+ if user['deleted'] is False:
+ if user['real_name'] == '':
+ full_name = user['name']
+ else:
+ full_name = user['real_name']
+
# userprofile's quota is hardcoded as per
# https://github.com/zulip/zulip/blob/e1498988d9094961e6f9988fb308b3e7310a8e74/zerver/migrations/0059_userprofile_quota.py#L18
userprofile = dict(
@@ -86,7 +92,7 @@ def users2zerver_userprofile(slack_dir: str, realm_id: int, timestamp: Any,
last_login=timestamp,
tos_version=None,
default_all_public_streams=False,
- full_name=user.get('real_name', user['name']),
+ full_name=full_name,
twenty_four_hour_time=False,
groups=[], # This is Zulip-specific
enable_online_push_notifications=False,
@@ -106,7 +112,7 @@ def users2zerver_userprofile(slack_dir: str, realm_id: int, timestamp: Any,
default_language="en",
enable_sounds=True,
pm_content_in_desktop_notifications=True,
- is_active=user['deleted'],
+ is_active=not user['deleted'],
onboarding_steps="[]",
emojiset="google",
emoji_alt_code=False,
@@ -366,7 +372,8 @@ def channelmessage2zerver_message_one_stream(constants, channel, added_users,
subject=channel, # This is Zulip-specific
pub_date=msg['ts'],
id=message_id,
- has_attachment=has_attachment, # attachment will be posted in the subsequent message; this is how Slack does it, i.e. less like email
+ has_attachment=has_attachment, # attachment will be posted in the subsequent message;
+ # this is how Slack does it, i.e. less like email
edit_history=None,
sender=added_users[user], # map slack id to zulip id
content=sanitize_text(text),
diff --git a/zulip/integrations/slack/zerver_realm_skeleton.json b/zulip/integrations/slack/zerver_realm_skeleton.json
index 5950875c..491e15b6 100644
--- a/zulip/integrations/slack/zerver_realm_skeleton.json
+++ b/zulip/integrations/slack/zerver_realm_skeleton.json
@@ -7,7 +7,7 @@
"waiting_period_threshold": 0,
"email_changes_disabled": false,
"deactivated": false,
- "notifications_stream": 1,
+ "notifications_stream": null,
"restricted_to_domain": true,
"show_digest_email": true,
"allow_message_editing": true,