From dfbf8b808657fcfe70bd31c6232edecaad15dbc0 Mon Sep 17 00:00:00 2001 From: Harshit Bansal Date: Mon, 19 Jun 2017 15:03:04 +0000 Subject: [PATCH] bugdown: Remove shortname mention syntax. We used shortnames for mentioning users before we had autocomplete feature. Since we now have autocomplete typeahead, this syntax is no more useful and just causes problems. This commit removes the shortname mention syntax. Fixes: #4189. --- zerver/lib/bugdown/__init__.py | 2 -- zerver/tests/test_bugdown.py | 16 +--------------- zerver/tests/test_notifications.py | 10 +++++----- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/zerver/lib/bugdown/__init__.py b/zerver/lib/bugdown/__init__.py index 6588a1b6ca..b673bf44ba 100644 --- a/zerver/lib/bugdown/__init__.py +++ b/zerver/lib/bugdown/__init__.py @@ -1041,8 +1041,6 @@ class UserMentionPattern(markdown.inlinepatterns.Pattern): return (True, None) user = db_data['full_names'].get(name.lower(), None) - if user is None: - user = db_data['short_names'].get(name.lower(), None) return (False, user) diff --git a/zerver/tests/test_bugdown.py b/zerver/tests/test_bugdown.py index 861ccd2e6e..e1c6a28df0 100644 --- a/zerver/tests/test_bugdown.py +++ b/zerver/tests/test_bugdown.py @@ -716,20 +716,6 @@ class BugdownTest(ZulipTestCase): '@King Hamlet

' % (self.example_email("hamlet"), user_id)) self.assertEqual(msg.mentions_user_ids, set([user_profile.id])) - def test_mention_shortname(self): - # type: () -> None - sender_user_profile = self.example_user('othello') - user_profile = self.example_user('hamlet') - msg = Message(sender=sender_user_profile, sending_client=get_client("test")) - user_id = user_profile.id - - content = "@**hamlet**" - self.assertEqual(render_markdown(msg, content), - '

' - '@King Hamlet

' % (self.example_email("hamlet"), user_id)) - self.assertEqual(msg.mentions_user_ids, set([user_profile.id])) - def test_mention_multiple(self): # type: () -> None sender_user_profile = self.example_user('othello') @@ -737,7 +723,7 @@ class BugdownTest(ZulipTestCase): cordelia = self.example_user('cordelia') msg = Message(sender=sender_user_profile, sending_client=get_client("test")) - content = "@**King Hamlet** and @**cordelia**, check this out" + content = "@**King Hamlet** and @**Cordelia Lear**, check this out" self.assertEqual(render_markdown(msg, content), '

' '