aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/request/_incoming_correspondence.html.erb19
-rw-r--r--spec/integration/view_request_spec.rb12
2 files changed, 22 insertions, 9 deletions
diff --git a/app/views/request/_incoming_correspondence.html.erb b/app/views/request/_incoming_correspondence.html.erb
index f4cf3b2ab..591556f10 100644
--- a/app/views/request/_incoming_correspondence.html.erb
+++ b/app/views/request/_incoming_correspondence.html.erb
@@ -1,8 +1,11 @@
<div class="incoming correspondence <%= incoming_message.prominence %>" id="incoming-<%=incoming_message.id.to_s%>">
<%- if not incoming_message.user_can_view?(@user) %>
<p id="hidden_message">
- <%= _('This message has been hidden. There are various reasons why we might have done this, sorry we can\'t be more specific here. Please <a href="{{url}}">contact us</a> if you have any questions.', :url => help_contact_path.html_safe) %>
-
+ <%- if incoming_message.prominence_reason %>
+ <%= _('This message has been hidden. {{reason}} Please <a href="{{url}}">contact us</a> if you have any questions.', :url => help_contact_path.html_safe, :reason => incoming_message.prominence_reason) %>
+ <%- else %>
+ <%= _('This message has been hidden. There are various reasons why we might have done this, sorry we can\'t be more specific here. Please <a href="{{url}}">contact us</a> if you have any questions.', :url => help_contact_path.html_safe) %>
+ <%- end %>
<% if incoming_message.prominence == 'requester_only' %>
<%= _('If you are the requester, then you may <a href="{{url}}">sign in</a> to view the message.', :url => signin_url(:r => request.fullpath).html_safe) %>
<% end %>
@@ -10,12 +13,20 @@
<%- else %>
<% if incoming_message.prominence == 'hidden' %>
<p id="hidden_message">
- <%= _('This message has prominence \'hidden\'. You can only see it because you are logged in as a super user.') %>
+ <%- if incoming_message.prominence_reason %>
+ <%= _('This message has prominence \'hidden\'. {{reason}} You can only see it because you are logged in as a super user.', :reason => incoming_message.prominence_reason) %>
+ <%- else %>
+ <%= _('This message has prominence \'hidden\'. You can only see it because you are logged in as a super user.') %>
+ <%- end %>
</p>
<% end %>
<% if incoming_message.prominence == 'requester_only' %>
<p id="hidden_message">
- <%= _('This message is hidden, so that only you, the requester, can see it. Please <a href="{{url}}">contact us</a> if you are not sure why.', :url => help_requesting_path.html_safe) %>
+ <%- if incoming_message.prominence_reason %>
+ <%= _('This message is hidden, so that only you, the requester, can see it. {{reason}}', :url => help_requesting_path.html_safe, :reason => incoming_message.prominence_reason) %>
+ <%- else %>
+ <%= _('This message is hidden, so that only you, the requester, can see it. Please <a href="{{url}}">contact us</a> if you are not sure why.', :url => help_requesting_path.html_safe) %>
+ <%- end %>
</p>
<% end %>
<h2>
diff --git a/spec/integration/view_request_spec.rb b/spec/integration/view_request_spec.rb
index 6f02cff7c..f8be4a938 100644
--- a/spec/integration/view_request_spec.rb
+++ b/spec/integration/view_request_spec.rb
@@ -59,6 +59,7 @@ describe "When viewing requests" do
before do
useless_message = incoming_messages(:useless_incoming_message)
useless_message.prominence = 'hidden'
+ useless_message.prominence_reason = 'It is too irritating.'
useless_message.save!
end
@@ -68,14 +69,14 @@ describe "When viewing requests" do
# unregistered
unregistered = without_login
unregistered.browses_request('why_do_you_have_such_a_fancy_dog')
- unregistered.response.body.should include("This message has been hidden.")
+ unregistered.response.body.should include("This message has been hidden. It is too irritating.")
unregistered.response.body.should_not include("sign in</a> to view the message.")
unregistered.response.body.should_not include("No way!")
# requester
bob = login(:bob_smith_user)
bob.browses_request('why_do_you_have_such_a_fancy_dog')
- bob.response.body.should include("This message has been hidden.")
+ bob.response.body.should include("This message has been hidden. It is too irritating")
bob.response.body.should_not include("No way!")
# admin
@@ -83,7 +84,7 @@ describe "When viewing requests" do
admin_user = login(:admin_user)
admin_user.browses_request('why_do_you_have_such_a_fancy_dog')
admin_user.response.body.should include('No way!')
- admin_user.response.body.should include("This message has prominence \'hidden\'. You can only see it because you are logged in as a super user.")
+ admin_user.response.body.should include("This message has prominence \'hidden\'. It is too irritating. You can only see it because you are logged in as a super user.")
end
@@ -94,6 +95,7 @@ describe "When viewing requests" do
before do
useless_message = incoming_messages(:useless_incoming_message)
useless_message.prominence = 'requester_only'
+ useless_message.prominence_reason = 'It is too irritating.'
useless_message.save!
end
@@ -103,7 +105,7 @@ describe "When viewing requests" do
# unregistered
unregistered = without_login
unregistered.browses_request('why_do_you_have_such_a_fancy_dog')
- unregistered.response.body.should include("This message has been hidden.")
+ unregistered.response.body.should include("This message has been hidden. It is too irritating")
unregistered.response.body.should include("sign in</a> to view the message.")
unregistered.response.body.should_not include("No way!")
@@ -111,7 +113,7 @@ describe "When viewing requests" do
bob = login(:bob_smith_user)
bob.browses_request('why_do_you_have_such_a_fancy_dog')
bob.response.body.should include("No way!")
- bob.response.body.should include("This message is hidden, so that only you, the requester, can see it.")
+ bob.response.body.should include("This message is hidden, so that only you, the requester, can see it. It is too irritating.")
# admin
confirm(:admin_user)