From 89d0dd56b9426c349c5af04d4ae4d790f0a53027 Mon Sep 17 00:00:00 2001 From: rht Date: Mon, 6 May 2019 05:34:13 +0100 Subject: [PATCH] slack-bridge: Fall back to real_name when display_name is empty. This will intentionally raise exception when a real_name field of a user is empty. --- zulip/integrations/bridge_with_slack/run-slack-bridge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zulip/integrations/bridge_with_slack/run-slack-bridge b/zulip/integrations/bridge_with_slack/run-slack-bridge index 4a62baa..919763f 100755 --- a/zulip/integrations/bridge_with_slack/run-slack-bridge +++ b/zulip/integrations/bridge_with_slack/run-slack-bridge @@ -77,7 +77,7 @@ class SlackBridge: _wc = slack.WebClient(token=self.slack_config["token"]) members = _wc.users_list() # See also https://api.slack.com/changelog/2017-09-the-one-about-usernames - self.slack_id_to_name = {u["id"]: u["profile"]["display_name"] for u in members} + self.slack_id_to_name = {u["id"]: u["profile"].get("display_name", u["profile"]["real_name"]) for u in members} self.slack_name_to_id = {v: k for k, v in self.slack_id_to_name.items()} @slack.RTMClient.run_on(event='message')