summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-06-30 18:09:17 -0400
committerJoram Wilander <jwawilander@gmail.com>2015-06-30 18:09:17 -0400
commitfd3dc5c5e5cbf1cc00aa67829028f175ddcee3f8 (patch)
tree33e7de4007d73fbbb07472f74659a280414490bc /web
parent7a7be75e742603d06927a488b136e1ed4432aac2 (diff)
parent71d0a9472f22e34c24bcdd61ce14748f5ca7ae43 (diff)
downloadchat-fd3dc5c5e5cbf1cc00aa67829028f175ddcee3f8.tar.gz
chat-fd3dc5c5e5cbf1cc00aa67829028f175ddcee3f8.tar.bz2
chat-fd3dc5c5e5cbf1cc00aa67829028f175ddcee3f8.zip
Merge pull request #111 from rgarmsen2295/mm-1305
MM-1305 The word "constructor" will no longer be highlighted
Diffstat (limited to 'web')
-rw-r--r--web/react/utils/utils.jsx12
1 files changed, 4 insertions, 8 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index d50a044bc..08b83d084 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -398,11 +398,7 @@ module.exports.textToJsx = function(text, options) {
// Function specific regexes
var hashRegex = /^href="#[^"]+"|(#[A-Za-z]+[A-Za-z0-9_]*[A-Za-z0-9])$/g;
- var implicitKeywords = {};
- var keywordArray = UserStore.getCurrentMentionKeys();
- for (var i = 0; i < keywordArray.length; i++) {
- implicitKeywords[keywordArray[i]] = true;
- }
+ var implicitKeywords = UserStore.getCurrentMentionKeys();
var lines = text.split("\n");
var urlMatcher = new LinkifyIt();
@@ -427,7 +423,7 @@ module.exports.textToJsx = function(text, options) {
{
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 = implicitKeywords.indexOf('@'+name.toLowerCase()) !== -1 || implicitKeywords.indexOf('@'+name) !== -1 ? mentionClass : "";
var suffix = word.match(puncEndRegex);
var prefix = word.match(puncStartRegex);
@@ -449,7 +445,7 @@ module.exports.textToJsx = function(text, options) {
} else if (trimWord.match(hashRegex)) {
var suffix = word.match(puncEndRegex);
var prefix = word.match(puncStartRegex);
- var mClass = trimWord in implicitKeywords || trimWord.toLowerCase() in implicitKeywords ? mentionClass : "";
+ var mClass = implicitKeywords.indexOf(trimWord) !== -1 || implicitKeywords.indexOf(trimWord.toLowerCase()) !== -1 ? mentionClass : "";
if (searchTerm === trimWord.substring(1).toLowerCase() || searchTerm === trimWord.toLowerCase()) {
highlightSearchClass = " search-highlight";
@@ -457,7 +453,7 @@ module.exports.textToJsx = function(text, options) {
inner.push(<span key={word+i+z+"_span"}>{prefix}<a key={word+i+z+"_hash"} className={"theme " + mClass + highlightSearchClass} href="#" onClick={function(value) { return function() { module.exports.searchForTerm(value); } }(trimWord)}>{trimWord}</a>{suffix} </span>);
- } else if (trimWord in implicitKeywords || trimWord.toLowerCase() in implicitKeywords) {
+ } else if (implicitKeywords.indexOf(trimWord) !== -1 || implicitKeywords.indexOf(trimWord.toLowerCase()) !== -1) {
var suffix = word.match(puncEndRegex);
var prefix = word.match(puncStartRegex);