From 220678ae40905904af88bb3d98ac0dde23847eb4 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 14 Nov 2013 19:00:35 -0500 Subject: [PATCH] Support emojis/bolding/etc. in single-line /me messages. (imported from commit c62ae8cf26117e30a029e025021cc4a3a67f4a83) --- zerver/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zerver/models.py b/zerver/models.py index 80cf489792..328998aab0 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -526,12 +526,14 @@ class Message(models.Model): domain = "mit.edu/zephyr_mirror" rendered_content = bugdown.convert(content, domain, self) - # For /me syntax, we pass back the raw content. The JS can detect /me + # For /me syntax, we pass back a /me prefix. The JS can detect /me # (no paragraph tag) and do special rendering. We might eventually # want to handle this with a flag, but it's a bit tough to deliver the # flag through all code paths, given the current code structure. - if content.startswith('/me ') and rendered_content == '

%s

' % (content,): - return content + if content.startswith('/me ') and '\n' not in content: + if rendered_content.startswith('

') and rendered_content.endswith('

'): + rendered_content = rendered_content[3:-4] + return rendered_content return rendered_content