diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 9 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 7930ff6b1..e9fec8fda 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -1390,4 +1390,13 @@ sub hook_report_filter_status { } @$status; } +# If report is made by a flagged user, mark as non-public +sub report_new_munge_before_insert { + my ($self, $report) = @_; + + if ($report->user->flagged) { + $report->non_public(1); + } +} + 1; diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index 8def10d4f..97ac19761 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -14,6 +14,9 @@ use FixMyStreet::Script::Reports; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; +FixMyStreet::App->log->disable('info'); +END { FixMyStreet::App->log->enable('info'); } + # Check that you have the required locale installed - the following # should return a line with de_CH.utf8 in. If not install that locale. # @@ -764,6 +767,14 @@ subtest "phone number is mandatory" => sub { $mech->get_ok( '/report/new?lat=47.381817&lon=8.529156' ); $mech->submit_form( with_fields => { phone => "" } ); $mech->content_contains( 'Diese Information wird benötigt' ); +}; + +subtest 'test flagged users make internal reports' => sub { + $user->update({ flagged => 1 }); + $mech->submit_form( with_fields => { phone => "01234", category => 'Cat1', detail => 'Details' } ); + my $report = FixMyStreet::DB->resultset('Problem')->search(undef, { order_by => { -desc => 'id' }, rows => 1 })->single; + is $report->non_public, 1; + $report->delete; $mech->log_out_ok; }; |