Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variables to hidden user explanation templates #8121

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
* 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
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
Loading