aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm19
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm14
-rw-r--r--perllib/FixMyStreet/Script/Reports.pm3
3 files changed, 25 insertions, 11 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index e4e82f091..a41aeb6ea 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -1300,9 +1300,17 @@ sub save_user_and_report : Private {
if ( $c->cobrand->never_confirm_reports ) {
$report->user->update_or_insert;
$report->confirm();
- } elsif ( $c->forward('created_as_someone_else', [ $c->stash->{bodies} ]) ) {
- # If created on behalf of someone else, we automatically confirm it,
- # but we don't want to update the user account
+ # If created on behalf of someone else, we automatically confirm it,
+ # but we don't want to update the user account
+ } elsif ($c->stash->{contributing_as_another_user}) {
+ $report->set_extra_metadata( contributed_as => 'another_user');
+ $report->set_extra_metadata( contributed_by => $c->user->id );
+ $report->confirm();
+ } elsif ($c->stash->{contributing_as_body}) {
+ $report->set_extra_metadata( contributed_as => 'body' );
+ $report->confirm();
+ } elsif ($c->stash->{contributing_as_anonymous_user}) {
+ $report->set_extra_metadata( contributed_as => 'anonymous_user' );
$report->confirm();
} elsif ( !$report->user->in_storage ) {
# User does not exist.
@@ -1342,11 +1350,6 @@ sub save_user_and_report : Private {
return 1;
}
-sub created_as_someone_else : Private {
- my ($self, $c, $bodies) = @_;
- return $c->stash->{contributing_as_another_user} || $c->stash->{contributing_as_body} || $c->stash->{contributing_as_anonymous_user};
-}
-
=head2 generate_map
Add the html needed to for the map to the stash.
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index 99eae8659..9d97688c5 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -444,9 +444,17 @@ sub save_update : Private {
if ( $c->cobrand->never_confirm_updates ) {
$update->user->update_or_insert;
$update->confirm();
- } elsif ( $c->forward('/report/new/created_as_someone_else', [ $update->problem->bodies_str ]) ) {
- # If created on behalf of someone else, we automatically confirm it,
- # but we don't want to update the user account
+ # If created on behalf of someone else, we automatically confirm it,
+ # but we don't want to update the user account
+ } elsif ($c->stash->{contributing_as_another_user}) {
+ $update->set_extra_metadata( contributed_as => 'another_user');
+ $update->set_extra_metadata( contributed_by => $c->user->id );
+ $update->confirm();
+ } elsif ($c->stash->{contributing_as_body}) {
+ $update->set_extra_metadata( contributed_as => 'body' );
+ $update->confirm();
+ } elsif ($c->stash->{contributing_as_anonymous_user}) {
+ $update->set_extra_metadata( contributed_as => 'anonymous_user' );
$update->confirm();
} elsif ( !$update->user->in_storage ) {
# User does not exist.
diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm
index b8c3d6d0d..1d19ee283 100644
--- a/perllib/FixMyStreet/Script/Reports.pm
+++ b/perllib/FixMyStreet/Script/Reports.pm
@@ -294,6 +294,9 @@ sub _send_report_sent_email {
# Don't send 'report sent' text
return unless $row->user->email_verified;
+ my $contributed_as = $row->get_extra_metadata('contributed_as') || '';
+ return if $contributed_as eq 'body' || $contributed_as eq 'anonymous_user';
+
FixMyStreet::Email::send_cron(
$row->result_source->schema,
'confirm_report_sent.txt',