summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-08-12 02:01:11 +0800
committerGitHub <noreply@github.com>2017-08-12 02:01:11 +0800
commit4cf316fcd39dbb654bb07d80b0dfa9f8194c571d (patch)
tree8d3ff2dff290b8dc793661e961a5fbf505f5d570 /webapp/utils
parent638c38cc0d2296335a0fbd5bde8b6d2cbf9f9062 (diff)
downloadchat-4cf316fcd39dbb654bb07d80b0dfa9f8194c571d.tar.gz
chat-4cf316fcd39dbb654bb07d80b0dfa9f8194c571d.tar.bz2
chat-4cf316fcd39dbb654bb07d80b0dfa9f8194c571d.zip
[PLT-7342] Add function and tests to specifically determine @all & @channel (#7181)
* add function and tests to specifically determine @all & @channel * uodate per comments - regex and tests
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/post_utils.jsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/webapp/utils/post_utils.jsx b/webapp/utils/post_utils.jsx
index 9309e1e49..83fb666af 100644
--- a/webapp/utils/post_utils.jsx
+++ b/webapp/utils/post_utils.jsx
@@ -107,3 +107,12 @@ export function shouldShowDotMenu(post) {
return false;
}
+
+export function containsAtMention(text, key) {
+ if (!text || !key) {
+ return false;
+ }
+
+ // This doesn't work for at mentions containing periods or hyphens
+ return new RegExp(`\\B${key}\\b`, 'i').test(text);
+}