Remove "(Telegram)" from mentions

This commit is contained in:
Max Sandholm 2017-09-21 14:42:12 +03:00
parent e98b7312f6
commit 9e003f8ff9

View File

@ -97,7 +97,7 @@ def format_matrix_msg(form, content):
:return: The formatted string. :return: The formatted string.
""" """
if 'format' in content and content['format'] == 'org.matrix.custom.html': if 'format' in content and content['format'] == 'org.matrix.custom.html':
sanitized = re.sub("<a href=\\\"https://matrix.to/#/@telegram_([0-9]+):{}\\\">(.+?)</a>".format(MATRIX_HOST_BARE), "<a href=\"tg://user?id=\\1\">\\2</a>", content['formatted_body']) sanitized = re.sub("<a href=\\\"https://matrix.to/#/@telegram_([0-9]+):{}\\\">(.+?) \(Telegram\)</a>".format(MATRIX_HOST_BARE), "<a href=\"tg://user?id=\\1\">\\2</a>", content['formatted_body'])
sanitized = sanitize_html(sanitized) sanitized = sanitize_html(sanitized)
return html.escape(form).format(sanitized), 'HTML' return html.escape(form).format(sanitized), 'HTML'
else: else: