FIX: prevent cross-contamination of emojis in multisites

This commit is contained in:
Régis Hanol 2015-10-30 23:26:34 +01:00
parent 5e3da94c46
commit 7fbf902d09
2 changed files with 7 additions and 0 deletions

View File

@ -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); });

View File

@ -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}');")