Skip to content

Commit

Permalink
Help us CTA from delivery error message
Browse files Browse the repository at this point in the history
Finding contact details can take a fair amount of work. Users are often
happy to help, but the only signpost we have for this is when submitting
the classification. They might not have time to source a new address
there and then – and the form itself could be improved – but a reminder
for them and other users viewing the requests might help distribute some
of this work to the community.

Fixes #1782.
  • Loading branch information
garethrees committed Nov 9, 2023
1 parent 00f13d2 commit 3dc355e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
10 changes: 7 additions & 3 deletions app/helpers/info_request_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,14 @@ def status_text_internal_review(info_request, _opts = {})
public_body_link: public_body_link(info_request.public_body))
end

def status_text_error_message(_info_request, _opts = {})
def status_text_error_message(info_request, _opts = {})
body = info_request.public_body
_('There was a <strong>delivery error</strong> or similar, which ' \
'needs fixing by the {{site_name}} team.',
site_name: site_name)
'needs fixing by the {{site_name}} team. Can you help by ' \
'<a href="{{change_request_url}}">finding updated contact ' \
'details</a>?',
site_name: site_name,
change_request_url: new_change_request_body_path(body: body.url_name))
end

def status_text_requires_admin(_info_request, _opts = {})
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

* Signpost users to find new contact details for requests with delivery errors
(Gareth Rees)
* Add internal ID number to authority CSV download (Alex Parsons, Graeme
Porteous)

Expand Down
12 changes: 10 additions & 2 deletions spec/helpers/info_request_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,17 @@
context 'error_message' do

it 'returns a description' do
allow(info_request).to receive(:calculate_status).and_return("error_message")
allow(info_request).
to receive(:public_body).and_return(double(url_name: 'foo'))

allow(info_request).
to receive(:calculate_status).and_return('error_message')

expected = 'There was a <strong>delivery error</strong> or similar, ' \
'which needs fixing by the Alaveteli team.'
'which needs fixing by the Alaveteli team. Can you help ' \
'by <a href="/change_request/new/foo">finding updated ' \
'contact details</a>?'

expect(status_text(info_request)).to eq(expected)
end

Expand Down

0 comments on commit 3dc355e

Please sign in to comment.