Fix regression #5467: fixes emoji copy (#5739)

pull/5744/head
Clworld 2017-11-18 02:22:31 +09:00 committed by Eugen Rochko
parent ae6dd08121
commit e1ebf36352
1 changed files with 3 additions and 2 deletions

View File

@ -45,9 +45,10 @@ module Admin
def copy def copy
authorize @custom_emoji, :copy? authorize @custom_emoji, :copy?
emoji = CustomEmoji.find_or_create_by(domain: nil, shortcode: @custom_emoji.shortcode) emoji = CustomEmoji.find_or_initialize_by(domain: nil, shortcode: @custom_emoji.shortcode)
emoji.image = @custom_emoji.image
if emoji.update(image: @custom_emoji.image) if emoji.save
flash[:notice] = I18n.t('admin.custom_emojis.copied_msg') flash[:notice] = I18n.t('admin.custom_emojis.copied_msg')
else else
flash[:alert] = I18n.t('admin.custom_emojis.copy_failed_msg') flash[:alert] = I18n.t('admin.custom_emojis.copy_failed_msg')