summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-06-30 11:58:22 -0400
committerJoram Wilander <jwawilander@gmail.com>2015-06-30 11:58:22 -0400
commita00b4e00adeacfbe59b523d46e566186631eab52 (patch)
tree83949f6e97ecac3c09084b06c943b1fdf33f8873 /web/react/utils
parentae21685e357416dab708e304fd8d9c005b11278d (diff)
parent8be4df00b4d30c220d6f0d13734501c8c94e6495 (diff)
downloadchat-a00b4e00adeacfbe59b523d46e566186631eab52.tar.gz
chat-a00b4e00adeacfbe59b523d46e566186631eab52.tar.bz2
chat-a00b4e00adeacfbe59b523d46e566186631eab52.zip
Merge pull request #106 from mattermost/mm-1119
fixes mm-1119 adds @all and @channel mention capabilites
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/constants.jsx1
-rw-r--r--web/react/utils/utils.jsx7
2 files changed, 6 insertions, 2 deletions
diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx
index a5124afe2..3aadfb4b0 100644
--- a/web/react/utils/constants.jsx
+++ b/web/react/utils/constants.jsx
@@ -36,6 +36,7 @@ module.exports = {
SERVER_ACTION: null,
VIEW_ACTION: null
}),
+ SPECIAL_MENTIONS: ['all', 'channel'],
CHARACTER_LIMIT: 4000,
IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png'],
AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac'],
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 75c583c8f..d50a044bc 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -421,10 +421,13 @@ module.exports.textToJsx = function(text, options) {
highlightSearchClass = " search-highlight";
}
- if (explicitMention && UserStore.getProfileByUsername(explicitMention[1])) {
+ if (explicitMention &&
+ (UserStore.getProfileByUsername(explicitMention[1]) ||
+ Constants.SPECIAL_MENTIONS.indexOf(explicitMention[1]) !== -1))
+ {
var name = explicitMention[1];
// do both a non-case sensitive and case senstive check
- var mClass = (name.toLowerCase() in implicitKeywords || name in implicitKeywords) ? mentionClass : "";
+ var mClass = (('@'+name.toLowerCase()) in implicitKeywords || ('@'+name) in implicitKeywords) ? mentionClass : "";
var suffix = word.match(puncEndRegex);
var prefix = word.match(puncStartRegex);