diff --git a/src/channel/emotes.js b/src/channel/emotes.js index 31ae3d97..3ebf1411 100644 --- a/src/channel/emotes.js +++ b/src/channel/emotes.js @@ -168,12 +168,11 @@ EmoteModule.prototype.handleRenameEmote = function (user, data) { return; } + this.emotes.renameEmote(Object.assign({}, f)); + var chan = this.channel; chan.broadcastAll("renameEmote", f); chan.logger.log(`[mod] ${user.getName()} renamed emote: ${f.old} -> ${f.name}`); - - // Doing this after the broadcast because this function deletes the "old" prop - this.emotes.renameEmote(f); }; EmoteModule.prototype.handleUpdateEmote = function (user, data) { diff --git a/www/js/callbacks.js b/www/js/callbacks.js index 550d0ea9..d2d1438e 100644 --- a/www/js/callbacks.js +++ b/www/js/callbacks.js @@ -1039,6 +1039,7 @@ Callbacks = { // But wasn't bad before: Add it to bad list if(!badBefore){ CHANNEL.badEmotes.push(data); + delete CHANNEL.emoteMap[oldName]; } // Was bad before too: Update else { @@ -1060,7 +1061,10 @@ Callbacks = { break; } } + } else { + delete CHANNEL.emoteMap[oldName]; } + CHANNEL.emoteMap[data.name] = data; } EMOTELIST.handleChange(); diff --git a/www/js/util.js b/www/js/util.js index 370ef3ca..342ebdfa 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -3146,7 +3146,7 @@ CSEmoteList.prototype.loadPage = function (page) { if(val === emote.name){ return } // Emote name already exists - if( CHANNEL.emotes.filter((emote)=>{ return emote.name === val }).length ){ + if( CHANNEL.emotes.filter(function(emote){ return emote.name === val }).length ){ /* * Since we are already in a modal * and Bootstrap doesn't have supermodals