diff --git a/plugins/emoji/assets/javascripts/emoji.js.erb b/plugins/emoji/assets/javascripts/emoji.js.erb index ec4038d77c4..7d2ed8e8921 100644 --- a/plugins/emoji/assets/javascripts/emoji.js.erb +++ b/plugins/emoji/assets/javascripts/emoji.js.erb @@ -64,11 +64,9 @@ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&') } - var translationColonRegexp = new RegExp("^" + - Object.keys(translationsWithColon).map(function (t) { + var translationColonRegexp = new RegExp(Object.keys(translationsWithColon).map(function (t) { return "(" + escapeRegExp(t) + ")"; - }).join("|") - ); + }).join("|")); Discourse.Dialect.registerInline(':', function(text, match, prev) { var endPos = text.indexOf(':', 1), @@ -80,11 +78,11 @@ // If there is no trailing colon, check our translations that begin with colons if (endPos === -1 || (firstSpace !== -1 && endPos > firstSpace)) { translationColonRegexp.lastIndex = 0; - var match = translationColonRegexp.exec(text); - if (match && match[0]) { - contents = imageFor(translationsWithColon[match[0]]); + var m = translationColonRegexp.exec(text); + if (m && m[0] && text.indexOf(m[0]) === 0) { + contents = imageFor(translationsWithColon[m[0]]); if (contents) { - return [match[0].length, contents]; + return [m[0].length, contents]; } } return; diff --git a/test/javascripts/components/home_logo_component_test.js b/test/javascripts/components/home_logo_component_test.js index 8063d36a45c..c6b88432274 100644 --- a/test/javascripts/components/home_logo_component_test.js +++ b/test/javascripts/components/home_logo_component_test.js @@ -131,9 +131,3 @@ test("dynamically toggles logo size when 'minimized' property changes", function setMinimized(false); ok(exists(fixture(bigLogoSelector)), "when 'minimized' version is turned off, small logo is replaced with the big one"); }); - -test("links logo to the site root", function() { - appendView(); - - equal(fixture(".title > a").attr("href"), "/"); -});