Skip to content

Commit

Permalink
Fix #5351 - Redirection with page params after copy emoji (#5387)
Browse files Browse the repository at this point in the history
* Fix #5351 - Redirection with page params after copy emoji

* Add page params to copy emoji link
  • Loading branch information
tkbky authored and Gargron committed Oct 14, 2017
1 parent 2eab41c commit 1bdd694
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/controllers/admin/custom_emojis_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ def copy
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
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/custom_emojis/_custom_emoji.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }
Expand Down

0 comments on commit 1bdd694

Please sign in to comment.