[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
Этот коммит содержится в:
Saturnino Abril
2017-08-12 02:01:11 +08:00
коммит произвёл GitHub
родитель 638c38cc0d
Коммит 4cf316fcd3
3 изменённых файлов: 108 добавлений и 1 удалений

Просмотреть файл

@@ -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);
}