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 ad25f27853. 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.
This commit is contained in:
Rohitt Vashishtha 2020-03-18 09:11:29 +05:30 committed by showell
parent 1dac75f979
commit fe78a363b0
2 changed files with 2 additions and 2 deletions

View file

@ -165,7 +165,7 @@ class ExternalBotHandler:
if message['type'] == 'private': if message['type'] == 'private':
return self.send_message(dict( return self.send_message(dict(
type='private', 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, content=response,
widget_content=widget_content, widget_content=widget_content,
)) ))

View file

@ -120,7 +120,7 @@ class LibTest(TestCase):
expected = [({'type': 'private', 'display_recipient': [to]}, expected = [({'type': 'private', 'display_recipient': [to]},
{'type': 'private', 'to': [to['email']]}, None), {'type': 'private', 'to': [to['email']]}, None),
({'type': 'private', 'display_recipient': [to, profile]}, ({'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', 'display_recipient': 'Stream name', 'subject': 'Topic'},
{'type': 'stream', 'to': 'Stream name', 'subject': 'Topic'}, 'test widget')] {'type': 'stream', 'to': 'Stream name', 'subject': 'Topic'}, 'test widget')]
response_text = "Response" response_text = "Response"