aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-06-18 13:43:49 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-11-11 10:29:20 +0000
commitb2735e814c73fe76c8526563b7c5473281938833 (patch)
tree731d5fecb6a07124e1d0ff94dfc4518e6c54a9a5
parentac82484fb2e2acc95012d8ba0894b1165743b8ea (diff)
[Bromley] No updates on waste reports.
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm10
-rw-r--r--t/app/controller/waste.t4
-rw-r--r--templates/web/bromley/report/_updates_disallowed_message.html13
3 files changed, 27 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index 5fc03eb81..c9e85a484 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -406,6 +406,16 @@ sub munge_report_new_contacts {
$self->SUPER::munge_report_new_contacts($categories);
}
+sub updates_disallowed {
+ my $self = shift;
+ my ($problem) = @_;
+
+ # No updates on waste reports
+ return 'waste' if $problem->cobrand_data eq 'waste';
+
+ return $self->next::method(@_);
+}
+
sub bin_addresses_for_postcode {
my $self = shift;
my $pc = shift;
diff --git a/t/app/controller/waste.t b/t/app/controller/waste.t
index 9c7b9a3ac..fe1b369d9 100644
--- a/t/app/controller/waste.t
+++ b/t/app/controller/waste.t
@@ -99,8 +99,12 @@ FixMyStreet::override_config {
is $res->code, 403;
$mech->log_in_ok($user->email);
$mech->get_ok('/report/' . $report->id);
+ $mech->content_lacks('Provide an update');
+ $report->update({ state => 'fixed - council' });
$mech->log_in_ok($staff_user->email);
$mech->get_ok('/report/' . $report->id);
+ $mech->content_lacks('Provide an update');
+ $mech->content_contains( '<a href="/waste/uprn/1000000002">See your bin collections</a>' );
$mech->host('www.fixmystreet.com');
$res = $mech->get('/report/' . $report->id);
diff --git a/templates/web/bromley/report/_updates_disallowed_message.html b/templates/web/bromley/report/_updates_disallowed_message.html
new file mode 100644
index 000000000..436bc6354
--- /dev/null
+++ b/templates/web/bromley/report/_updates_disallowed_message.html
@@ -0,0 +1,13 @@
+[% IF c.cobrand.updates_disallowed(problem) == 'waste';
+ SET uprn = problem.get_extra_field_value('uprn');
+%]
+<p>
+ <a href="/waste[% IF uprn %]/uprn/[% uprn %][% END %]">See your bin collections</a>.
+</p>
+[% ELSE %]
+<p>[% loc('This report is now closed to updates.') %]
+ [% tprintf(loc('You can <a href="%s">make a new report in the same location</a>.'),
+ c.uri_for( '/report/new', { longitude = longitude, latitude = latitude } )
+ ) %]
+</p>
+[% END %]