From 3443533ce3836673b0533c8474717a41e7f107fe Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 27 Dec 2023 18:54:29 +0300 Subject: [PATCH] Add revoke all blocks page title --- app/controllers/user_blocks_controller.rb | 2 +- app/views/user_blocks/revoke_all.html.erb | 8 ++++++++ config/locales/en.yml | 3 +++ test/system/user_blocks_test.rb | 6 +++++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/controllers/user_blocks_controller.rb b/app/controllers/user_blocks_controller.rb index bf61f906b..a671f0d16 100644 --- a/app/controllers/user_blocks_controller.rb +++ b/app/controllers/user_blocks_controller.rb @@ -8,7 +8,7 @@ class UserBlocksController < ApplicationController authorize_resource - before_action :lookup_user, :only => [:new, :create, :blocks_on, :blocks_by] + before_action :lookup_user, :only => [:new, :create, :revoke_all, :blocks_on, :blocks_by] before_action :lookup_user_block, :only => [:show, :edit, :update, :revoke] before_action :require_valid_params, :only => [:create, :update] before_action :check_database_readable diff --git a/app/views/user_blocks/revoke_all.html.erb b/app/views/user_blocks/revoke_all.html.erb index e69de29bb..982792ddd 100644 --- a/app/views/user_blocks/revoke_all.html.erb +++ b/app/views/user_blocks/revoke_all.html.erb @@ -0,0 +1,8 @@ +<% @title = t ".title", + :block_on => @user.display_name %> + +<% content_for :heading do %> +

<%= t ".heading_html", + :block_on => link_to(@user.display_name, + user_path(@user)) %>

+<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 8bb239ca5..449b6e540 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2893,6 +2893,9 @@ en: confirm: "Are you sure you wish to revoke this block?" revoke: "Revoke!" flash: "This block has been revoked." + revoke_all: + title: "Revoking all blocks on %{block_on}" + heading_html: "Revoking all blocks on %{block_on}" helper: time_future_html: "Ends in %{time}." until_login: "Active until the user logs in." diff --git a/test/system/user_blocks_test.rb b/test/system/user_blocks_test.rb index e1247d6a4..66a8befec 100644 --- a/test/system/user_blocks_test.rb +++ b/test/system/user_blocks_test.rb @@ -27,12 +27,16 @@ class ReportNoteTest < ApplicationSystemTestCase assert_no_link "Revoke all blocks" end - test "revoke all link is present for moderators when viewed user has active blocks" do + test "revoke all link is present and working for moderators when viewed user has active blocks" do blocked_user = create(:user) create(:user_block, :user => blocked_user) sign_in_as(create(:moderator_user)) visit user_path(blocked_user) assert_link "Revoke all blocks" + + click_link "Revoke all blocks" + assert_title "Revoking all blocks on #{blocked_user.display_name}" + assert_text "Revoking all blocks on #{blocked_user.display_name}" end end -- 2.39.5