From fe78a363b02643811377caaecf82463aa302880d Mon Sep 17 00:00:00 2001 From: Rohitt Vashishtha Date: Wed, 18 Mar 2020 09:11:29 +0530 Subject: [PATCH] bots: Do not remove self from list of recipients in group PMs. The origin of this line seems like an arbitary decision when writing the wikipedia bot in ad25f278534bc21310c1e3bd8a8021154bc19126. Removing self doesn't have any other significance, and not making any changes to the recipient list helps with https://github.com/zulip/zulip/issues/14228. Fixes #552. --- zulip_bots/zulip_bots/lib.py | 2 +- zulip_bots/zulip_bots/tests/test_lib.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index 93783a2..1911e58 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -165,7 +165,7 @@ class ExternalBotHandler: if message['type'] == 'private': return self.send_message(dict( type='private', - to=[x['email'] for x in message['display_recipient'] if self.email != x['email']], + to=[x['email'] for x in message['display_recipient']], content=response, widget_content=widget_content, )) diff --git a/zulip_bots/zulip_bots/tests/test_lib.py b/zulip_bots/zulip_bots/tests/test_lib.py index dede35a..9d60ccf 100644 --- a/zulip_bots/zulip_bots/tests/test_lib.py +++ b/zulip_bots/zulip_bots/tests/test_lib.py @@ -120,7 +120,7 @@ class LibTest(TestCase): expected = [({'type': 'private', 'display_recipient': [to]}, {'type': 'private', 'to': [to['email']]}, None), ({'type': 'private', 'display_recipient': [to, profile]}, - {'type': 'private', 'to': [to['email']]}, 'widget_content'), + {'type': 'private', 'to': [to['email'], profile['email']]}, 'widget_content'), ({'type': 'stream', 'display_recipient': 'Stream name', 'subject': 'Topic'}, {'type': 'stream', 'to': 'Stream name', 'subject': 'Topic'}, 'test widget')] response_text = "Response"