diff --git a/engine/apps/alerts/incident_appearance/templaters/classic_markdown_templater.py b/engine/apps/alerts/incident_appearance/templaters/classic_markdown_templater.py index 385d186a..31d13fa7 100644 --- a/engine/apps/alerts/incident_appearance/templaters/classic_markdown_templater.py +++ b/engine/apps/alerts/incident_appearance/templaters/classic_markdown_templater.py @@ -1,7 +1,4 @@ -import re - from apps.alerts.incident_appearance.templaters.alert_templater import AlertTemplater -from common.utils import convert_md_to_html, escape_html, url_re, urlize_with_respect_to_a class AlertClassicMarkdownTemplater(AlertTemplater): @@ -11,20 +8,13 @@ class AlertClassicMarkdownTemplater(AlertTemplater): return self.RENDER_FOR def _postformat(self, templated_alert): - link_substitution = {} if templated_alert.title: - templated_alert.title = escape_html(self._slack_format_for_web(templated_alert.title)) + templated_alert.title = self._slack_format(templated_alert.title) if templated_alert.message: - message = escape_html(self._slack_format_for_web(templated_alert.message)) - link_matches = re.findall(url_re, message) - for idx, link in enumerate(link_matches): - substitution = f"amixrsubstitutedlink{idx}" - link_substitution[substitution] = link - message = message.replace(link, substitution) - + templated_alert.message = self._slack_format(templated_alert.message) return templated_alert - def _slack_format_for_web(self, data): + def _slack_format(self, data): sf = self.slack_formatter sf.hyperlink_mention_format = "[{title}]({url})" return sf.format(data)