From b1bcebd8d68fe8fb6df43b6d68b353543da53660 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Mon, 20 Jan 2025 07:34:44 +0300 Subject: [PATCH] Display past blocks button on accounts block page --- app/views/accounts/blocks/index.html.erb | 6 ++++++ config/locales/en.yml | 1 + test/controllers/accounts/blocks_controller_test.rb | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/app/views/accounts/blocks/index.html.erb b/app/views/accounts/blocks/index.html.erb index cf7458fb38..1df08ea151 100644 --- a/app/views/accounts/blocks/index.html.erb +++ b/app/views/accounts/blocks/index.html.erb @@ -3,3 +3,9 @@ <% end %>

<%= t ".no_active_blocks" %>

+ +<% if current_user.blocks.exists? %> +
+ <%= link_to t(".review_button"), user_received_blocks_path(current_user), :class => "btn btn-outline-primary" %> +
+<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index e5d102feba..a239c44542 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -280,6 +280,7 @@ en: index: title: Blocks on Me no_active_blocks: There are no active blocks on your account. + review_button: Review past blocks deletions: show: title: Delete My Account diff --git a/test/controllers/accounts/blocks_controller_test.rb b/test/controllers/accounts/blocks_controller_test.rb index 6088da383e..6802d86461 100644 --- a/test/controllers/accounts/blocks_controller_test.rb +++ b/test/controllers/accounts/blocks_controller_test.rb @@ -24,6 +24,7 @@ def test_index_not_blocked assert_response :success assert_dom "#content > .content-body" do assert_dom "p", :text => /no active blocks/ + assert_dom "a", :text => "Review past blocks", :count => 0 end end @@ -36,6 +37,9 @@ def test_index_with_inactive_block assert_response :success assert_dom "#content > .content-body" do assert_dom "p", :text => /no active blocks/ + assert_dom "a", :text => "Review past blocks" do + assert_dom "> @href", user_received_blocks_path(user) + end end end