Skip to content

Commit

Permalink
Fix regression #5467: fixes emoji copy (#5739)
Browse files Browse the repository at this point in the history
  • Loading branch information
clworld authored and Gargron committed Nov 17, 2017
1 parent ae6dd08 commit e1ebf36
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/controllers/admin/custom_emojis_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ def destroy
def 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')
else
flash[:alert] = I18n.t('admin.custom_emojis.copy_failed_msg')
Expand Down

0 comments on commit e1ebf36

Please sign in to comment.