Add revoke all blocks page title

This commit is contained in:
Anton Khorev 2023-12-27 18:54:29 +03:00
parent ba53dc7b04
commit 3443533ce3
4 changed files with 17 additions and 2 deletions

View file

@ -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

View file

@ -0,0 +1,8 @@
<% @title = t ".title",
:block_on => @user.display_name %>
<% content_for :heading do %>
<h1><%= t ".heading_html",
:block_on => link_to(@user.display_name,
user_path(@user)) %></h1>
<% end %>

View file

@ -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."

View file

@ -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