From d85a29650d9c2f71a9dd49ac51dd0a1188457e1c Mon Sep 17 00:00:00 2001 From: decidim-bot Date: Fri, 18 Oct 2024 11:12:04 +0200 Subject: [PATCH] Fix redirect path after blocking an user (#13561) * Fix redirect path after blocking a user * Changed icons Co-authored-by: andra-panaite <135139066+andra-panaite@users.noreply.github.com> --- .../app/controllers/decidim/admin/block_user_controller.rb | 2 +- .../app/views/decidim/admin/moderated_users/index.html.erb | 4 ++-- decidim-admin/lib/decidim/admin/engine.rb | 1 + decidim-admin/spec/controllers/block_user_controller_spec.rb | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/decidim-admin/app/controllers/decidim/admin/block_user_controller.rb b/decidim-admin/app/controllers/decidim/admin/block_user_controller.rb index 205b3cdc83807..0ce59e8755dd1 100644 --- a/decidim-admin/app/controllers/decidim/admin/block_user_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/block_user_controller.rb @@ -22,7 +22,7 @@ def create BlockUser.call(@form) do on(:ok) do flash[:notice] = I18n.t("officializations.block.success", scope: "decidim.admin") - redirect_to moderated_users_path(blocked: true), notice: + redirect_to moderated_users_path, notice: end on(:invalid) do diff --git a/decidim-admin/app/views/decidim/admin/moderated_users/index.html.erb b/decidim-admin/app/views/decidim/admin/moderated_users/index.html.erb index bd777df1d2605..3f197003a9240 100644 --- a/decidim-admin/app/views/decidim/admin/moderated_users/index.html.erb +++ b/decidim-admin/app/views/decidim/admin/moderated_users/index.html.erb @@ -51,9 +51,9 @@ <% end %> <% if allowed_to?(:block, :moderate_users) %> <% if moderation.user.blocked? %> - <%= icon_link_to "forbid-2-line", user_block_path(user_id: moderation.user.id), t(".actions.unblock"), class: "action-icon action-icon--disabled", method: :delete %> + <%= icon_link_to "refresh-line", user_block_path(user_id: moderation.user.id), t(".actions.unblock"), class: "action-icon action-icon--disabled", method: :delete %> <% else %> - <%= icon_link_to "forbid-2-line", new_user_block_path(user_id: moderation.user.id), t(".actions.block"), class: "action-icon action-icon" %> + <%= icon_link_to "lock-2-line", new_user_block_path(user_id: moderation.user.id), t(".actions.block"), class: "action-icon action-icon" %> <% end %> <% end %> diff --git a/decidim-admin/lib/decidim/admin/engine.rb b/decidim-admin/lib/decidim/admin/engine.rb index bf2d427b75574..316e184a72bd7 100644 --- a/decidim-admin/lib/decidim/admin/engine.rb +++ b/decidim-admin/lib/decidim/admin/engine.rb @@ -26,6 +26,7 @@ class Engine < ::Rails::Engine end initializer "decidim_admin.register_icons" do |_app| + Decidim.icons.register(name: "lock-2-line", icon: "lock-2-line", category: "system", description: "Block user icon", engine: :admin) Decidim.icons.register(name: "layout-masonry-line", icon: "layout-masonry-line", category: "system", description: "", engine: :admin) Decidim.icons.register(name: "service-line", icon: "service-line", category: "system", description: "", engine: :admin) Decidim.icons.register(name: "fullscreen-line", icon: "fullscreen-line", category: "system", description: "", engine: :admin) diff --git a/decidim-admin/spec/controllers/block_user_controller_spec.rb b/decidim-admin/spec/controllers/block_user_controller_spec.rb index af1bd582d5e46..a99bc480980a8 100644 --- a/decidim-admin/spec/controllers/block_user_controller_spec.rb +++ b/decidim-admin/spec/controllers/block_user_controller_spec.rb @@ -75,6 +75,7 @@ module Admin expect(flash[:notice]).to be_present expect(user.reload.blocked?).to be(true) + expect(response).not_to redirect_to(moderated_users_path(blocked: true)) end end