Skip to content

Commit a0296f5

Browse files
authored
[slack] Add hue username in bot's slack message for author context and update API UTs (#2058)
1 parent b51ce37 commit a0296f5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

desktop/core/src/desktop/lib/botserver/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def send_message(request):
5050
channel = request.POST.get('channel')
5151
message = request.POST.get('message')
5252

53+
message = '@' + (request.user.get_full_name() or request.user.username) + ': ' + message
5354
slack_response = _send_message(channel, message)
5455

5556
return JsonResponse({

desktop/core/src/desktop/lib/botserver/api_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def test_send_message(self):
7575
"ok": True,
7676
}
7777

78-
response = self.client.post(reverse('botserver.api.send_message'), {'channel': 'channel-1', 'message': 'some message'})
78+
response = self.client.post(reverse('botserver.api.send_message'), {'channel': 'channel-1', 'message': 'message with link'})
7979
data = json.loads(response.content)
8080

8181
assert_equal(200, response.status_code)
82-
chat_postMessage.assert_called_with(channel='channel-1', text='some message')
82+
chat_postMessage.assert_called_with(channel='channel-1', text='@api_user: message with link')
8383
assert_true(data.get('ok'))

0 commit comments

Comments
 (0)