diff options
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 2 | ||||
-rw-r--r-- | t/cobrand/hounslow.t | 17 | ||||
-rw-r--r-- | templates/web/hounslow/report/_council_sent_info.html | 12 |
3 files changed, 29 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index dc45091ee..c1608b35d 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -755,7 +755,7 @@ sub defect_types { # Note: this only makes sense when called on a problem that has been sent! sub can_display_external_id { my $self = shift; - if ($self->external_id && $self->send_method_used && $self->to_body_named('Oxfordshire|Lincolnshire')) { + if ($self->external_id && $self->to_body_named('Oxfordshire|Lincolnshire')) { return 1; } return 0; diff --git a/t/cobrand/hounslow.t b/t/cobrand/hounslow.t index 417bc7736..8fac848b1 100644 --- a/t/cobrand/hounslow.t +++ b/t/cobrand/hounslow.t @@ -9,6 +9,8 @@ $mech->create_contact_ok( email => 'pothole@example.org', ); +$mech->create_user_ok('staff@example.org', from_body => $hounslow_id); + my $tfl = $mech->create_body_ok( 2483, 'TfL'); $mech->create_contact_ok( body_id => $tfl->id, @@ -23,7 +25,8 @@ $mech->create_problems_for_body(1, $hounslow_id, 'An old problem made before Hou $mech->create_problems_for_body(1, $hounslow_id, 'A brand new problem made on the Hounslow site', { cobrand => 'hounslow' }); -$mech->create_problems_for_body(1, $hounslow_id, 'A brand new problem made on fixmystreet.com', { +my ($report) = $mech->create_problems_for_body(1, $hounslow_id, 'A brand new problem made on fixmystreet.com', { + external_id => 'ABC123', cobrand => 'fixmystreet' }); @@ -63,4 +66,16 @@ subtest "does not show TfL traffic lights category" => sub { }; }; +subtest "Shows external ID on report page to staff users only" => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => 'hounslow', + }, sub { + $mech->get_ok('/report/' . $report->id); + $mech->content_lacks('ABC123'); + $mech->log_in_ok('staff@example.org'); + $mech->get_ok('/report/' . $report->id); + $mech->content_contains('ABC123'); + }; +}; + done_testing(); diff --git a/templates/web/hounslow/report/_council_sent_info.html b/templates/web/hounslow/report/_council_sent_info.html new file mode 100644 index 000000000..921f17f5f --- /dev/null +++ b/templates/web/hounslow/report/_council_sent_info.html @@ -0,0 +1,12 @@ +[% SET can_display_external_id = problem.external_id AND c.user_exists AND c.user.belongs_to_body(problem.bodies_str) %] +[% SET duration_clause = problem.duration_string(c) %] +[% IF duration_clause || can_display_external_id %] + <p class="council_sent_info"> + [% duration_clause %] + [%- IF can_display_external_id %] + [%- external_ref_clause = tprintf('Reference: %s', problem.external_id) %] + [%- IF duration_clause %]. [% END %] + <strong>[% external_ref_clause %].</strong> + [%- END %] + </p> +[% END %] |