diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 4e58a57831..8094200ea4 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -55,13 +55,26 @@ def other_country_message end def hidden_user_explanation - reason = render_to_string( + prominence_reason = render_to_string( partial: "admin_request/hidden_user_explanation/#{params[:message]}", - formats: [:text] + formats: [:text], + locals: { + prominence_reason: true, + explanation: false + } + ) + + explanation = render_to_string( + partial: "admin_request/hidden_user_explanation/#{params[:message]}", + formats: [:text], + locals: { + prominence_reason: false, + explanation: true + } ) render json: { - prominence_reason: reason, + prominence_reason: prominence_reason, explanation: render_to_string( template: "admin_request/hidden_user_explanation", formats: [:text], @@ -69,7 +82,7 @@ def hidden_user_explanation locals: { name_to: @info_request.user_name.html_safe, info_request: @info_request, - reason: reason, + explanation: explanation, info_request_url: request_url(@info_request), site_name: site_name.html_safe } diff --git a/app/views/admin_request/hidden_user_explanation.text.erb b/app/views/admin_request/hidden_user_explanation.text.erb index 8118946806..2c6e57baa7 100644 --- a/app/views/admin_request/hidden_user_explanation.text.erb +++ b/app/views/admin_request/hidden_user_explanation.text.erb @@ -4,7 +4,7 @@ request: info_request.title.html_safe, url: info_request_url) %> -<%= reason -%> +<%= explanation -%> <%= _('You will still be able to view it while logged in to the site. ' \ 'Please reply to this email if you would like to discuss this decision ' \ diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 53badfc545..d0bf1a8607 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -2,6 +2,8 @@ ## Highlighted Features +* Improve rendering of admin hidden request prominence and explanations (Graeme + Porteous) * Fix duplicated attachment masking jobs (Graeme Porteous) * Display metadata on admin attachment views (Graeme Porteous) * Change request URL patterns to be member routes (Alexander Griffen, Graeme diff --git a/spec/views/admin_request/hidden_user_explanation.text.erb_spec.rb b/spec/views/admin_request/hidden_user_explanation.text.erb_spec.rb index 1a6a4b3177..e333849ad8 100644 --- a/spec/views/admin_request/hidden_user_explanation.text.erb_spec.rb +++ b/spec/views/admin_request/hidden_user_explanation.text.erb_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' RSpec.describe 'admin_request/hidden_user_explanation' do - let(:reason) do + let(:explanation) do "We consider it to be vexatious, and have therefore hidden it from other " \ "users.\n" end @@ -16,7 +16,7 @@ locals: { name_to: 'Bob Smith', info_request: double(title: 'Foo'), info_request_url: 'https://test.host/request/foo', - reason: reason, + explanation: explanation, site_name: 'Alaveteli' } end