Skip to content

Commit

Permalink
Fix redirect path after blocking an user (decidim#13562)
Browse files Browse the repository at this point in the history
* Fix redirect path after blocking a user

* Changed icons

Co-authored-by: andra-panaite <135139066+andra-panaite@users.noreply.github.com>
  • Loading branch information
decidim-bot and andra-panaite authored Oct 18, 2024
1 parent f264e6d commit 406fc03
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
</td>
Expand Down
1 change: 1 addition & 0 deletions decidim-admin/lib/decidim/admin/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 406fc03

Please sign in to comment.