bugdown: Add custom per-realm filters to linkify certain strings.

I've tried to do this in a way that's scalable and easily configured,
so that we can add new such filters for customers on-demand without
needing to add anything other than a bit of configuration.

Once we're confident in the arguments to this system, I think we'll
want to move the regular expression lists into the database so that we
don't need to do a prod push to modify the regular expression lists.

The initial set of regular expressions are:
(1) Linkifying e.g. "trac #224" in the Humbug realm, so we're exercising this code.
(2) The various ticket number things CUSTOMER7 uses for the CUSTOMER7 realm.

(imported from commit 992b0937b9012c15a7c2f585eb0aacb221c52e01)
This commit is contained in:
Tim Abbott
2013-06-05 11:45:57 -04:00
parent ceacf6f97e
commit 0ad1094e45
4 changed files with 63 additions and 18 deletions

View File

@@ -455,7 +455,7 @@ def check_message(sender, client, message_type_name, message_to,
else:
return "Invalid message type"
rendered_content = bugdown.convert(message_content)
rendered_content = bugdown.convert(message_content, sender.realm.domain)
if rendered_content is None:
return "We were unable to render your message"
@@ -958,7 +958,7 @@ def do_update_message(user_profile, message_id, subject, content):
first_rendered_content = message.rendered_content
if content is not None:
rendered_content = bugdown.convert(content)
rendered_content = bugdown.convert(content, message.sender.realm.domain)
if rendered_content is None:
raise JsonableError("We were unable to render your updated message")