summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-09-20 11:59:42 -0400
committerChristopher Speller <crspeller@gmail.com>2016-09-20 11:59:42 -0400
commite455bee39f2480782d350f156043141fb6bdab26 (patch)
tree6a3b4a542afbdf2a625b4278ea7cf86cfdf5252e /webapp/utils
parentb072fdb23f61f9ebd424567025b80d370c371532 (diff)
downloadchat-e455bee39f2480782d350f156043141fb6bdab26.tar.gz
chat-e455bee39f2480782d350f156043141fb6bdab26.tar.bz2
chat-e455bee39f2480782d350f156043141fb6bdab26.zip
PLT-4096 Fixed highlighting of hashtags in search (#4043)
* PLT-4096 Fixed highlighting of hashtags in search * Added unit tests for hashtag rendering on the client
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/text_formatting.jsx4
1 files changed, 2 insertions, 2 deletions
diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index 174620d47..23e286b45 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -415,8 +415,8 @@ function convertSearchTermToRegex(term) {
pattern = '()(' + escapeRegex(term.replace(/\*/g, '')) + ')';
} else if (term.endsWith('*')) {
pattern = '\\b()(' + escapeRegex(term.substring(0, term.length - 1)) + ')';
- } else if (term.startsWith('@')) {
- // needs special handling of the first boundary because a word boundary doesn't work before an @ sign
+ } else if (term.startsWith('@') || term.startsWith('#')) {
+ // needs special handling of the first boundary because a word boundary doesn't work before a symbol
pattern = '(\\W|^)(' + escapeRegex(term) + ')\\b';
} else {
pattern = '\\b()(' + escapeRegex(term) + ')\\b';