diff --git a/app/assets/javascripts/discourse/lib/emoji/emoji.js.erb b/app/assets/javascripts/discourse/lib/emoji/emoji.js.erb index 8a8fceb2528..eff6b85e8e4 100644 --- a/app/assets/javascripts/discourse/lib/emoji/emoji.js.erb +++ b/app/assets/javascripts/discourse/lib/emoji/emoji.js.erb @@ -12,6 +12,11 @@ Discourse.Dialect.registerEmoji = function(code, url) { extendedEmoji[code] = url; }; +// This method is used by PrettyText to reset custom emojis in multisites +Discourse.Dialect.resetEmoji = function() { + extendedEmoji = {}; +}; + Discourse.Emoji.list = function(){ var list = emoji.slice(0); _.each(extendedEmoji, function(v,k){ list.push(k); }); diff --git a/lib/pretty_text.rb b/lib/pretty_text.rb index f6e2d523b5b..590576567a8 100644 --- a/lib/pretty_text.rb +++ b/lib/pretty_text.rb @@ -189,6 +189,8 @@ module PrettyText end end + # reset emojis (v8 context is shared amongst multisites) + context.eval("Discourse.Dialect.resetEmoji();") # custom emojis Emoji.custom.each do |emoji| context.eval("Discourse.Dialect.registerEmoji('#{emoji.name}', '#{emoji.url}');")