diff options
author | nullkal <nullkal@nil.nu> | 2017-11-07 22:49:32 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-11-07 14:49:32 +0100 |
commit | b6e2e999bd4c603bc36b1234af484184644104e9 (patch) | |
tree | f1aa9fc571fc656780e9b22a2c1dccb3f521997c /app/controllers | |
parent | 782224c99151665470b138add583d50df17b4380 (diff) |
Show the local couterpart of emoji when it exists in /admin/custom_emojis (#5467)
* Show the local couterpart of emoji when it exists in admin/custom_emojis * Fix indentation * Fix error * Add class table-action-link to Overwrite link * Make it enable to overwrite emojis * Make Code Climate happy
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/custom_emojis_controller.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/admin/custom_emojis_controller.rb b/app/controllers/admin/custom_emojis_controller.rb index cbd7abe95..daa1460fb 100644 --- a/app/controllers/admin/custom_emojis_controller.rb +++ b/app/controllers/admin/custom_emojis_controller.rb @@ -5,7 +5,7 @@ module Admin before_action :set_custom_emoji, except: [:index, :new, :create] def index - @custom_emojis = filtered_custom_emojis.page(params[:page]) + @custom_emojis = filtered_custom_emojis.eager_load(:local_counterpart).page(params[:page]) end def new @@ -36,9 +36,9 @@ module Admin end def copy - emoji = CustomEmoji.new(domain: nil, shortcode: @custom_emoji.shortcode, image: @custom_emoji.image) + emoji = CustomEmoji.find_or_create_by(domain: nil, shortcode: @custom_emoji.shortcode) - if emoji.save + if emoji.update(image: @custom_emoji.image) flash[:notice] = I18n.t('admin.custom_emojis.copied_msg') else flash[:alert] = I18n.t('admin.custom_emojis.copy_failed_msg') |