diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 13 | ||||
-rw-r--r-- | templates/web/base/report/display_tools.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/update-form.html | 2 |
4 files changed, 16 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index d67ead82d..1825286ca 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -244,8 +244,7 @@ This makes sure we only proceed to processing if we've had the form submitted sub check_form_submitted : Private { my ( $self, $c ) = @_; - return if $c->stash->{problem}->get_extra_metadata('closed_updates'); - return if $c->cobrand->call_hook(updates_disallowed => $c->stash->{problem}); + return if $c->cobrand->updates_disallowed($c->stash->{problem}); return $c->get_param('submit_update') || ''; } diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index d7bec65cd..a6c6f34c4 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -503,6 +503,19 @@ allowing them to report them as offensive. sub allow_update_reporting { return 0; } +=item updates_disallowed + +Returns a boolean indicating whether updates on a particular report are allowed +or not. Default behaviour is disallowed if "closed_updates" metadata is set. + +=cut + +sub updates_disallowed { + my ($self, $problem) = @_; + return 1 if $problem->get_extra_metadata('closed_updates'); + return 0; +} + =item geocode_postcode Given a QUERY, return LAT/LON and/or ERROR. diff --git a/templates/web/base/report/display_tools.html b/templates/web/base/report/display_tools.html index 4ba8c8b2c..ea12ab707 100644 --- a/templates/web/base/report/display_tools.html +++ b/templates/web/base/report/display_tools.html @@ -10,7 +10,7 @@ c.cobrand.moniker == 'fixmystreet' ? 'Unsuitable?' : loc('Report abuse') %]</a></li> [% END %] - [% IF NOT problem.extra.closed_updates AND c.cobrand.moniker != 'zurich' %] + [% IF NOT c.cobrand.updates_disallowed(problem) AND c.cobrand.moniker != 'zurich' %] <li><a rel="nofollow" id="key-tool-report-updates" class="feed js-feed" href="[% c.uri_for( '/alert/subscribe', { id => problem.id } ) %]">[% loc('Get updates' ) %]</a></li> [% END %] [% IF c.cobrand.moniker == 'fixmystreet' %] diff --git a/templates/web/base/report/update-form.html b/templates/web/base/report/update-form.html index afa110280..4c631d5e7 100644 --- a/templates/web/base/report/update-form.html +++ b/templates/web/base/report/update-form.html @@ -1,5 +1,5 @@ [% allow_creation = (!c.cobrand.only_authed_can_create || (c.user && c.user.from_body)) AND NOT c.cobrand.updates_disallowed(problem) %] -[% RETURN IF NOT allow_creation OR problem.extra.closed_updates %] +[% RETURN IF NOT allow_creation %] <div id="update_form"> [% IF NOT login_success AND NOT oauth_need_email %] |