Skip to content

Commit

Permalink
Merge branch 'add-hidden-user-explanation-template-vars' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Feb 9, 2024
2 parents 2893fee + 06d9963 commit 7b32171
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
21 changes: 17 additions & 4 deletions app/controllers/services_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,34 @@ 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],
layout: false,
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
}
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin_request/hidden_user_explanation.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' \
Expand Down
2 changes: 2 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Highlighted Features

* Improve rendering of admin hidden request prominence and explanations (Graeme
Porteous)
* Add admin list of all citations (Gareth Rees)
* Improve redirection flow after user account closure actions (Gareth Rees)
* Fix duplicated attachment masking jobs (Graeme Porteous)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down

0 comments on commit 7b32171

Please sign in to comment.