From 4ebc4a4ef1bb7fc53abb8dfe52406eea14dd7429 Mon Sep 17 00:00:00 2001 From: Luke Faraone Date: Wed, 12 Feb 2014 17:36:09 -0500 Subject: [PATCH] Expand characters allowed after an alertword. We now support .';[ before a word and ';]! after. Closes trac #2283. (imported from commit b3e3cb3d8d49a8e74d0b6a108c5ec73e9d9b5f32) --- static/js/alert_words.js | 4 ++-- zerver/lib/bugdown/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/static/js/alert_words.js b/static/js/alert_words.js index 5d1f7da753..38b7a1d312 100644 --- a/static/js/alert_words.js +++ b/static/js/alert_words.js @@ -17,8 +17,8 @@ exports.process_message = function (message) { _.each(exports.words, function (word) { var clean = escape_user_regex(word); - var before_punctuation = '\\s|^|>|[\\(\\"]'; - var after_punctuation = '\\s|$|<|[\\)\\"\\?:.,]'; + var before_punctuation = '\\s|^|>|[\\(\\".,\';\\[]'; + var after_punctuation = '\\s|$|<|[\\)\\"\\?!:.,\';\\]!]'; var regex = new RegExp('(' + before_punctuation + ')' + '(' + clean + ')' + diff --git a/zerver/lib/bugdown/__init__.py b/zerver/lib/bugdown/__init__.py index 669fa3ae14..e97875883f 100644 --- a/zerver/lib/bugdown/__init__.py +++ b/zerver/lib/bugdown/__init__.py @@ -770,8 +770,8 @@ class AlertWordsNotificationProcessor(markdown.preprocessors.Preprocessor): realm_words = db_data['realm_alert_words'] content = '\n'.join(lines).lower() - allowed_before_punctuation = "|".join([r'\s', '^', r'[\(\"]']) - allowed_after_punctuation = "|".join([r'\s', '$', r'[\)\"\?:.,]']) + allowed_before_punctuation = "|".join([r'\s', '^', r'[\(\".,\';\[]']) + allowed_after_punctuation = "|".join([r'\s', '$', r'[\)\"\?:.,\';\]!]']) for user_id, words in realm_words.iteritems(): for word in words: