Skip to content

Commit

Permalink
Fix regression mastodon#5467: fixes emoji copy (mastodon#5739)
Browse files Browse the repository at this point in the history
  • Loading branch information
clworld authored and cobodo committed Dec 6, 2017
1 parent 62a1e11 commit 724d836
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 724d836

Please sign in to comment.