mirror of https://github.com/zulip/zulip.git
Merge branch 'fix-issue-19589' of github.com:salandei/zulip into fix-issue-19589
This commit is contained in:
commit
4161bebd97
|
@ -149,6 +149,10 @@ Here's how we fill in the fields that a Slack-format webhook expects:
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>text</code></td>
|
<td><code>text</code></td>
|
||||||
<td>The content of the message (in Markdown)</td>
|
<td>The content of the message (in Markdown)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>command</code></td>
|
||||||
|
<td>The bot mention</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>trigger_word</code></td>
|
<td><code>trigger_word</code></td>
|
||||||
|
@ -173,8 +177,8 @@ The above data is posted as list of tuples (not JSON), here's an example:
|
||||||
('timestamp', 1532078950),
|
('timestamp', 1532078950),
|
||||||
('user_id', 'U21'),
|
('user_id', 'U21'),
|
||||||
('user_name', 'Full Name'),
|
('user_name', 'Full Name'),
|
||||||
('command', '@**test**'),
|
('command', '/test'),
|
||||||
('text', 'The content of the message'),
|
('text', 'content'),
|
||||||
('trigger_word', 'mention'),
|
('trigger_word', 'mention'),
|
||||||
('service_id', 27)]
|
('service_id', 27)]
|
||||||
```
|
```
|
||||||
|
|
|
@ -137,7 +137,7 @@ class SlackOutgoingWebhookService(OutgoingWebhookServiceInterface):
|
||||||
command_re = r"(@\*\*[\w]+\*\*)"
|
command_re = r"(@\*\*[\w]+\*\*)"
|
||||||
text = event["command"]
|
text = event["command"]
|
||||||
message_parts = re.split(command_re, text)
|
message_parts = re.split(command_re, text)
|
||||||
if re.fullmatch(command_re, message_parts[1]):
|
if len(message_parts) == 3 and re.fullmatch(command_re, message_parts[1]):
|
||||||
slash_command = "/" + message_parts[1][3:-2]
|
slash_command = "/" + message_parts[1][3:-2]
|
||||||
text = message_parts[2].strip()
|
text = message_parts[2].strip()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue