diff options
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); +} |