bots: Use ids for sending message.
This commit is contained in:
parent
5c32054415
commit
bdf0c7ff5c
|
@ -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']],
|
to=[x['id'] for x in message['display_recipient']],
|
||||||
content=response,
|
content=response,
|
||||||
widget_content=widget_content,
|
widget_content=widget_content,
|
||||||
))
|
))
|
||||||
|
|
|
@ -19,6 +19,7 @@ class FakeClient:
|
||||||
user_id='alice',
|
user_id='alice',
|
||||||
full_name='Alice',
|
full_name='Alice',
|
||||||
email='alice@example.com',
|
email='alice@example.com',
|
||||||
|
id=42,
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_storage(self, payload):
|
def update_storage(self, payload):
|
||||||
|
@ -117,11 +118,11 @@ class LibTest(TestCase):
|
||||||
bot_details=None,
|
bot_details=None,
|
||||||
bot_config_file=None
|
bot_config_file=None
|
||||||
)
|
)
|
||||||
to = {'email': 'Some@User'}
|
to = {'id': 43}
|
||||||
expected = [({'type': 'private', 'display_recipient': [to]},
|
expected = [({'type': 'private', 'display_recipient': [to]},
|
||||||
{'type': 'private', 'to': [to['email']]}, None),
|
{'type': 'private', 'to': [to['id']]}, None),
|
||||||
({'type': 'private', 'display_recipient': [to, profile]},
|
({'type': 'private', 'display_recipient': [to, profile]},
|
||||||
{'type': 'private', 'to': [to['email'], profile['email']]}, 'widget_content'),
|
{'type': 'private', 'to': [to['id'], profile['id']]}, '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"
|
||||||
|
|
Loading…
Reference in a new issue