FIX: be more lenient when deleting a custom emoji

This commit is contained in:
Régis Hanol
2017-11-20 23:50:23 +01:00
parent dcd60dcc8f
commit 2d48caffdf
4 changed files with 9 additions and 15 deletions

View File

@ -45,13 +45,8 @@ class Admin::EmojisController < Admin::AdminController
def destroy
name = params.require(:id)
custom_emoji = CustomEmoji.find_by(name: name)
raise Discourse::InvalidParameters unless custom_emoji
CustomEmoji.transaction do
custom_emoji.upload.destroy!
custom_emoji.destroy!
end
# NOTE: the upload will automatically be removed by the 'clean_up_uploads' job
CustomEmoji.find_by(name: name)&.destroy!
Emoji.clear_cache