|
8 | 8 | from zerver.actions.message_send import send_rate_limited_pm_notification_to_bot_owner
|
9 | 9 | from zerver.data_import.slack import check_token_access, get_slack_api_data
|
10 | 10 | from zerver.data_import.slack_message_conversion import (
|
11 |
| - SLACK_BOLD_REGEX, |
12 |
| - SLACK_ITALIC_REGEX, |
13 |
| - SLACK_STRIKETHROUGH_REGEX, |
14 | 11 | SLACK_USERMENTION_REGEX,
|
15 | 12 | convert_link_format,
|
16 | 13 | convert_mailto_format,
|
17 |
| - convert_markdown_syntax, |
| 14 | + convert_slack_formatting, |
| 15 | + convert_slack_workspace_mentions, |
18 | 16 | )
|
19 | 17 | from zerver.decorator import webhook_view
|
20 | 18 | from zerver.lib.exceptions import JsonableError, UnsupportedWebhookEventTypeError
|
@@ -97,22 +95,6 @@ def convert_to_zulip_markdown(text: str, slack_app_token: str) -> str:
|
97 | 95 | return text
|
98 | 96 |
|
99 | 97 |
|
100 |
| -def convert_slack_formatting(text: str) -> str: |
101 |
| - text = convert_markdown_syntax(text, SLACK_BOLD_REGEX, "**") |
102 |
| - text = convert_markdown_syntax(text, SLACK_STRIKETHROUGH_REGEX, "~~") |
103 |
| - text = convert_markdown_syntax(text, SLACK_ITALIC_REGEX, "*") |
104 |
| - return text |
105 |
| - |
106 |
| - |
107 |
| -def convert_slack_workspace_mentions(text: str) -> str: |
108 |
| - # Map Slack's <!everyone>, <!channel> and <!here> mentions to @**all**. |
109 |
| - # No regex for this as it can be present anywhere in the sentence. |
110 |
| - text = text.replace("<!everyone>", "@**all**") |
111 |
| - text = text.replace("<!channel>", "@**all**") |
112 |
| - text = text.replace("<!here>", "@**all**") |
113 |
| - return text |
114 |
| - |
115 |
| - |
116 | 98 | def replace_links(text: str) -> str:
|
117 | 99 | text, _ = convert_link_format(text)
|
118 | 100 | text, _ = convert_mailto_format(text)
|
|
0 commit comments