about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorClworld <clworld@ggtea.org>2017-11-18 02:22:31 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-11-17 18:22:31 +0100
commite1ebf363528fbbd3753436530baa6cc08ef5dd88 (patch)
tree10ba5260147c111aa97d29d2f4e2dd046aa2f1c3 /app
parentae6dd081210bd892812811e16094cda618466e8f (diff)
Fix regression #5467: fixes emoji copy (#5739)
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/custom_emojis_controller.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/admin/custom_emojis_controller.rb b/app/controllers/admin/custom_emojis_controller.rb
index 693d28b1f..509f7a48f 100644
--- a/app/controllers/admin/custom_emojis_controller.rb
+++ b/app/controllers/admin/custom_emojis_controller.rb
@@ -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')