diff options
5 files changed, 46 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index 0d2bf3663..bf7690990 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -256,10 +256,8 @@ sub about_hook { } } -sub updates_disallowed { - my $self = shift; - my ($problem) = @_; - my $c = $self->{c}; +sub updates_disallowed_config { + my ($self, $problem) = @_; # This is a hash of council name to match, and what to do my $cfg = $self->feature('updates_allowed') || {}; @@ -273,6 +271,15 @@ sub updates_disallowed { last; } } + return ($type, $body); +} + +sub updates_disallowed { + my $self = shift; + my ($problem) = @_; + my $c = $self->{c}; + + my ($type, $body) = $self->updates_disallowed_config($problem); if ($type eq 'none') { return 1; diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t index 1d22eb517..9e1b80c68 100644 --- a/t/cobrand/isleofwight.t +++ b/t/cobrand/isleofwight.t @@ -104,6 +104,7 @@ subtest "only original reporter can comment" => sub { FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', ALLOWED_COBRANDS => 'isleofwight', + COBRAND_FEATURES => { updates_allowed => { isleofwight => 'reporter' } }, }, sub { $mech->get_ok('/report/' . $reports[0]->id); $mech->content_contains('Only the original reporter may leave updates'); diff --git a/templates/web/fixmystreet-uk-councils/report/_updates_disallowed_message.html b/templates/web/fixmystreet-uk-councils/report/_updates_disallowed_message.html new file mode 100644 index 000000000..3a2dda03e --- /dev/null +++ b/templates/web/fixmystreet-uk-councils/report/_updates_disallowed_message.html @@ -0,0 +1,17 @@ +[% cfg = c.cobrand.feature("updates_allowed") ~%] +[% IF cfg.match('reporter') AND (NOT cfg.match('open') OR problem.is_open) %] + <p> + Only the original reporter may leave updates. + [% IF NOT c.user_exists %] + If you made the original report please + <a href="/auth?r=report/[% problem.id %]">log in</a> + to leave an update. + [% END %] + </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 %] diff --git a/templates/web/fixmystreet.com/report/_updates_disallowed_message.html b/templates/web/fixmystreet.com/report/_updates_disallowed_message.html new file mode 100644 index 000000000..d2d9cf83b --- /dev/null +++ b/templates/web/fixmystreet.com/report/_updates_disallowed_message.html @@ -0,0 +1,17 @@ +[% cfg = c.cobrand.updates_disallowed_config(problem).0 ~%] +[% IF cfg.match('reporter') AND (NOT cfg.match('open') OR problem.is_open) %] + <p> + Only the original reporter may leave updates. + [% IF NOT c.user_exists %] + If you made the original report please + <a href="/auth?r=report/[% problem.id %]">log in</a> + to leave an update. + [% END %] + </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 %] diff --git a/templates/web/isleofwight/report/_updates_disallowed_message.html b/templates/web/isleofwight/report/_updates_disallowed_message.html deleted file mode 100644 index af56f73b1..000000000 --- a/templates/web/isleofwight/report/_updates_disallowed_message.html +++ /dev/null @@ -1,8 +0,0 @@ -<p> - Only the original reporter may leave updates. - [% IF NOT c.user_exists %] - If you made the original report please - <a href="/auth?r=report/[% problem.id %]">log in</a> - to leave an update. - [% END %] -</p> |