FIX: support for more than 1 emojis in the title

This commit is contained in:
Régis Hanol 2015-06-15 23:44:39 +02:00
parent 76a14cd279
commit 357d4e3dd3
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@ const Topic = RestModel.extend({
let title = this.get("fancy_title"); let title = this.get("fancy_title");
if (Discourse.SiteSettings.enable_emoji && title.indexOf(":") >= 0) { if (Discourse.SiteSettings.enable_emoji && title.indexOf(":") >= 0) {
title = title.replace(/:\S+:?/, function(m) { title = title.replace(/:\S+:?/g, function(m) {
const emoji = Discourse.Emoji.translations[m] ? Discourse.Emoji.translations[m] : m.slice(1, m.length - 1), const emoji = Discourse.Emoji.translations[m] ? Discourse.Emoji.translations[m] : m.slice(1, m.length - 1),
url = Discourse.Emoji.urlFor(emoji); url = Discourse.Emoji.urlFor(emoji);
return url ? "<img src='" + url + "' title='" + emoji + "' alt='" + emoji + "' class='emoji'>" : m; return url ? "<img src='" + url + "' title='" + emoji + "' alt='" + emoji + "' class='emoji'>" : m;