aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/FixMyStreet/App/Controller/JSON.pm1
-rw-r--r--perllib/FixMyStreet/App/Controller/Open311.pm30
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/HighwaysEngland.pm9
-rw-r--r--t/cobrand/highwaysengland.t18
-rw-r--r--templates/web/base/contact/index.html2
-rw-r--r--templates/web/bathnes/contact/index.html2
8 files changed, 37 insertions, 28 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 256cf0e5b..cf3bfae5d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@
- Make sure category shown in all its groups when reporting.
- Do not remove any devolved contacts.
- Fix double encoding of per-category templates.
+ - Return reports in all closed states through Open311.
- Admin improvements:
- Display user name/email for contributed as reports. #2990
- Interface for enabling anonymous reports for certain categories. #2989
diff --git a/perllib/FixMyStreet/App/Controller/JSON.pm b/perllib/FixMyStreet/App/Controller/JSON.pm
index a7913bb4b..4657fcf2c 100644
--- a/perllib/FixMyStreet/App/Controller/JSON.pm
+++ b/perllib/FixMyStreet/App/Controller/JSON.pm
@@ -101,6 +101,7 @@ sub problems : Local {
} );
foreach my $problem (@problems) {
+ $c->cobrand->call_hook(munge_problem_list => $problem);
$problem->name( '' ) if $problem->anonymous == 1;
$problem->service( 'Web interface' ) if $problem->service eq '';
my $body_names = $problem->body_names;
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm
index b4b5d5e3a..73a91a62a 100644
--- a/perllib/FixMyStreet/App/Controller/Open311.pm
+++ b/perllib/FixMyStreet/App/Controller/Open311.pm
@@ -210,7 +210,7 @@ sub output_requests : Private {
};
# Look up categories for this council or councils
- my $problems = $c->cobrand->problems->search( $criteria, $attr );
+ my $problems = $c->stash->{rs}->search( $criteria, $attr );
my %statusmap = (
map( { $_ => 'open' } FixMyStreet::DB::Result::Problem->open_states() ),
@@ -220,6 +220,8 @@ sub output_requests : Private {
my @problemlist;
while ( my $problem = $problems->next ) {
+ $c->cobrand->call_hook(munge_problem_list => $problem);
+
my $id = $problem->id;
$problem->service( 'Web interface' ) unless $problem->service;
@@ -323,24 +325,8 @@ sub get_requests : Private {
if ( 'status' eq $param ) {
$value = {
'open' => [ FixMyStreet::DB::Result::Problem->open_states() ],
- 'closed' => [ FixMyStreet::DB::Result::Problem->fixed_states(), 'closed' ],
+ 'closed' => [ FixMyStreet::DB::Result::Problem->fixed_states(), FixMyStreet::DB::Result::Problem->closed_states() ],
}->{$value};
- } elsif ( 'agency_responsible' eq $param ) {
- my @valuelist;
- for my $agency (split(/\|/, $value)) {
- unless ($agency =~ m/^(\d+)$/) {
- $c->detach( 'error', [
- sprintf(_('Invalid agency_responsible value %s'),
- $value)
- ] );
- }
- my $agencyid = $1;
- # FIXME This seem to match the wrong entries
- # some times. Not sure when or why
- my $re = "(\\y$agencyid\\y|^$agencyid\\y|\\y$agencyid\$)";
- push(@valuelist, $re);
- }
- $value = \@valuelist;
} elsif ( 'has_photo' eq $param ) {
$value = undef;
$op = '!=' if 'true' eq $value;
@@ -363,6 +349,11 @@ sub get_requests : Private {
$criteria->{confirmed} = { '<', $c->get_param('end_date') };
}
+ $c->stash->{rs} = $c->cobrand->problems;
+ if (my $bodies = $c->get_param('agency_responsible')) {
+ $c->stash->{rs} = $c->stash->{rs}->to_body([ split(/\|/, $bodies) ]);
+ }
+
if ('rss' eq $c->stash->{format}) {
$c->stash->{type} = 'new_problems';
$c->forward( '/rss/lookup_type' );
@@ -384,7 +375,7 @@ sub rss_query : Private {
rows => $limit
};
- my $problems = $c->cobrand->problems->search( $criteria, $attr );
+ my $problems = $c->stash->{rs}->search( $criteria, $attr );
$c->stash->{problems} = $problems;
}
@@ -411,6 +402,7 @@ sub get_request : Private {
id => $id,
non_public => 0,
};
+ $c->stash->{rs} = $c->cobrand->problems;
$c->forward( 'output_requests', [ $criteria ] );
}
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 4d8794c59..4f9825cae 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -197,6 +197,7 @@ sub load_problem_or_display_error : Private {
}
}
+ $c->cobrand->call_hook(munge_problem_list => $problem);
$c->stash->{problem} = $problem;
if ( $c->user_exists && $c->user->can_moderate($problem) ) {
$c->stash->{problem_original} = $problem->find_or_new_related(
@@ -251,6 +252,7 @@ sub load_updates : Private {
my @combined;
my %questionnaires_with_updates;
while (my $update = $updates->next) {
+ $c->cobrand->call_hook(munge_update_list => $update);
push @combined, [ $update->confirmed, $update ];
if (my $qid = $update->get_extra_metadata('questionnaire_id')) {
$questionnaires_with_updates{$qid} = $update;
diff --git a/perllib/FixMyStreet/Cobrand/HighwaysEngland.pm b/perllib/FixMyStreet/Cobrand/HighwaysEngland.pm
index ed58eb4f7..c282ac5ea 100644
--- a/perllib/FixMyStreet/Cobrand/HighwaysEngland.pm
+++ b/perllib/FixMyStreet/Cobrand/HighwaysEngland.pm
@@ -29,6 +29,15 @@ sub users_restriction { FixMyStreet::Cobrand::UKCouncils::users_restriction($_[0
sub updates_restriction { FixMyStreet::Cobrand::UKCouncils::updates_restriction($_[0], $_[1]) }
sub base_url { FixMyStreet::Cobrand::UKCouncils::base_url($_[0]) }
+sub munge_problem_list {
+ my ($self, $problem) = @_;
+ $problem->anonymous(1);
+}
+sub munge_update_list {
+ my ($self, $update) = @_;
+ $update->anonymous(1);
+}
+
sub admin_allow_user {
my ( $self, $user ) = @_;
return 1 if $user->is_superuser;
diff --git a/t/cobrand/highwaysengland.t b/t/cobrand/highwaysengland.t
index f6400ea7c..0b71c613f 100644
--- a/t/cobrand/highwaysengland.t
+++ b/t/cobrand/highwaysengland.t
@@ -29,12 +29,11 @@ my $highways = $mech->create_body_ok(2234, 'Highways England');
$mech->create_contact_ok(email => 'highways@example.com', body_id => $highways->id, category => 'Pothole');
-# Br1 3UH
-subtest "check where heard from saved" => sub {
- FixMyStreet::override_config {
- ALLOWED_COBRANDS => 'highwaysengland',
- MAPIT_URL => 'http://mapit.uk/',
- }, sub {
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => 'highwaysengland',
+ MAPIT_URL => 'http://mapit.uk/',
+}, sub {
+ subtest "check where heard from saved" => sub {
$mech->get_ok('/around');
$mech->submit_form_ok( { with_fields => { pc => 'M1, J16', } }, "submit location" );
$mech->follow_link_ok( { text_regex => qr/skip this step/i, },
@@ -64,7 +63,12 @@ subtest "check where heard from saved" => sub {
like $mech->get_text_body_from_email($email), qr/Heard from: Facebook/, 'where hear included in email'
};
-};
+ subtest "check anonymous display" => sub {
+ my ($problem) = $mech->create_problems_for_body(1, $highways->id, 'Title');
+ $mech->get_ok('/report/' . $problem->id);
+ $mech->content_lacks('Reported by Test User at');
+ };
+};
done_testing();
diff --git a/templates/web/base/contact/index.html b/templates/web/base/contact/index.html
index 05a24160f..4e65ce674 100644
--- a/templates/web/base/contact/index.html
+++ b/templates/web/base/contact/index.html
@@ -63,7 +63,7 @@
[% IF problem.anonymous %]
[% tprintf( loc('Reported anonymously at %s'), prettify_dt( problem.confirmed ) ) %]
[% ELSE %]
- [% tprintf( loc('Reported by %s at %s'), problem.user.name, prettify_dt( problem.confirmed ) ) | html %]
+ [% tprintf( loc('Reported by %s at %s'), problem.name, prettify_dt( problem.confirmed ) ) | html %]
[% END %]
</cite>
diff --git a/templates/web/bathnes/contact/index.html b/templates/web/bathnes/contact/index.html
index f0589bd9e..aaa0d3c57 100644
--- a/templates/web/bathnes/contact/index.html
+++ b/templates/web/bathnes/contact/index.html
@@ -63,7 +63,7 @@
[% IF problem.anonymous %]
[% tprintf( loc('Reported anonymously at %s'), prettify_dt( problem.confirmed ) ) %]
[% ELSE %]
- [% tprintf( loc('Reported by %s at %s'), problem.user.name, prettify_dt( problem.confirmed ) ) | html %]
+ [% tprintf( loc('Reported by %s at %s'), problem.name, prettify_dt( problem.confirmed ) ) | html %]
[% END %]
</cite>