diff --git a/zerver/data_import/slack_message_conversion.py b/zerver/data_import/slack_message_conversion.py index 10953efc91..e12a8c5f61 100644 --- a/zerver/data_import/slack_message_conversion.py +++ b/zerver/data_import/slack_message_conversion.py @@ -151,6 +151,17 @@ def convert_markdown_syntax(text: str, regex: str, zulip_keyword: str) -> str: return text +def convert_slack_workspace_mentions(text: str) -> str: + # Map Slack's mention all: '' to '@**all** ' + # Map Slack's mention all: '' to '@**all** ' + # Map Slack's mention all: '' to '@**all** ' + # No regex for this as it can be present anywhere in the sentence + text = text.replace("", "@**all**") + text = text.replace("", "@**all**") + text = text.replace("", "@**all**") + return text + + # Markdown mapping def convert_to_zulip_markdown( text: str, @@ -163,13 +174,7 @@ def convert_to_zulip_markdown( text = convert_markdown_syntax(text, SLACK_STRIKETHROUGH_REGEX, "~~") text = convert_markdown_syntax(text, SLACK_ITALIC_REGEX, "*") - # Map Slack's mention all: '' to '@**all** ' - # Map Slack's mention all: '' to '@**all** ' - # Map Slack's mention all: '' to '@**all** ' - # No regex for this as it can be present anywhere in the sentence - text = text.replace("", "@**all**") - text = text.replace("", "@**all**") - text = text.replace("", "@**all**") + text = convert_slack_workspace_mentions(text) # Map Slack channel mention: '<#C5Z73A7RA|general>' to '#**general**' for cname, ids in added_channels.items():