diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-08-17 09:35:36 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-08-17 09:35:36 -0700 |
commit | fd1301779fecc2910a9fdcf93af52ff33a4349ba (patch) | |
tree | ccd8b35d347b77c8c6a99db9422b3dbc0ff3bd2d /webapp/utils/post_utils.jsx | |
parent | d41f1695e99a81808f5dc1fbe7820062947b5291 (diff) | |
parent | 0033e3e37b12cb5d951d21492500d66a6abc472b (diff) | |
download | chat-fd1301779fecc2910a9fdcf93af52ff33a4349ba.tar.gz chat-fd1301779fecc2910a9fdcf93af52ff33a4349ba.tar.bz2 chat-fd1301779fecc2910a9fdcf93af52ff33a4349ba.zip |
Merge branch 'release-4.1'
Diffstat (limited to 'webapp/utils/post_utils.jsx')
-rw-r--r-- | webapp/utils/post_utils.jsx | 9 |
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); +} |