]> cat aescling's git repositories - mastodon.git/commitdiff
Fix regression #5467: fixes emoji copy (#5739)
authorClworld <clworld@ggtea.org>
Fri, 17 Nov 2017 17:22:31 +0000 (02:22 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Fri, 17 Nov 2017 17:22:31 +0000 (18:22 +0100)
app/controllers/admin/custom_emojis_controller.rb

index 693d28b1f5b2a6da46b9bf3eee4d3f038740424b..509f7a48f7686663061e076e5d653954c50e2bf8 100644 (file)
@@ -45,9 +45,10 @@ module Admin
     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')