From 1bdd694a0a62c4dce608c5bd43d3015c072d8524 Mon Sep 17 00:00:00 2001 From: KY Date: Sat, 14 Oct 2017 20:40:10 +0800 Subject: [PATCH] Fix #5351 - Redirection with page params after copy emoji (#5387) * Fix #5351 - Redirection with page params after copy emoji * Add page params to copy emoji link --- app/controllers/admin/custom_emojis_controller.rb | 6 ++++-- app/views/admin/custom_emojis/_custom_emoji.html.haml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/custom_emojis_controller.rb b/app/controllers/admin/custom_emojis_controller.rb index ca81f3255..5cce5bce4 100644 --- a/app/controllers/admin/custom_emojis_controller.rb +++ b/app/controllers/admin/custom_emojis_controller.rb @@ -31,10 +31,12 @@ module Admin emoji = CustomEmoji.new(domain: nil, shortcode: @custom_emoji.shortcode, image: @custom_emoji.image) if emoji.save - redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.copied_msg') + flash[:notice] = I18n.t('admin.custom_emojis.copied_msg') else - redirect_to admin_custom_emojis_path, alert: I18n.t('admin.custom_emojis.copy_failed_msg') + flash[:alert] = I18n.t('admin.custom_emojis.copy_failed_msg') end + + redirect_to admin_custom_emojis_path(params[:page]) end def enable diff --git a/app/views/admin/custom_emojis/_custom_emoji.html.haml b/app/views/admin/custom_emojis/_custom_emoji.html.haml index 53263c43f..1fa64908c 100644 --- a/app/views/admin/custom_emojis/_custom_emoji.html.haml +++ b/app/views/admin/custom_emojis/_custom_emoji.html.haml @@ -10,7 +10,7 @@ = custom_emoji.domain %td - unless custom_emoji.local? - = table_link_to 'copy', t('admin.custom_emojis.copy'), copy_admin_custom_emoji_path(custom_emoji), method: :post + = table_link_to 'copy', t('admin.custom_emojis.copy'), copy_admin_custom_emoji_path(custom_emoji, page: params[:page]), method: :post %td - if custom_emoji.disabled? = table_link_to 'power-off', t('admin.custom_emojis.enable'), enable_admin_custom_emoji_path(custom_emoji), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }