diff options
author | Struan Donald <struan@exo.org.uk> | 2014-03-19 12:26:18 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2014-04-08 13:21:11 +0100 |
commit | f0c1e25cd4774996d6e523bdad73ae3d8f6cabae (patch) | |
tree | f37f4a6df7e372624d83aaccd6c6218dde9903e5 /perllib | |
parent | 96a2bb583e614cdd721909ebff21f3c1522e1024 (diff) |
Allow comments to be confirmed with no confirmation
Add never_confirm_updates setting to cobrand that, when set to 0 means
that comments are confirmed with no confirmation step. Essentially
behaves as it would if the user was logged in.
Also add a flag to the flash that indicates the comment was accepted to
you can display a message on the report page if required
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 10 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 8 |
2 files changed, 17 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index dbfd57e78..bc79cafd3 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -312,7 +312,14 @@ sub save_update : Private { my $update = $c->stash->{update}; - if ( !$update->user->in_storage ) { + if ( $c->cobrand->never_confirm_updates ) { + if ( $update->user->in_storage() ) { + $update->user->update(); + } else { + $update->user->insert(); + } + $update->confirm(); + } elsif ( !$update->user->in_storage ) { # User does not exist. # Store changes in token for when token is validated. $c->stash->{token_data} = { @@ -370,6 +377,7 @@ sub redirect_or_confirm_creation : Private { $c->forward( 'signup_for_alerts' ); my $report_uri = $c->cobrand->base_url_for_report( $update->problem ) . $update->problem->url; + $c->flash->{comment_created} = 1; $c->res->redirect($report_uri); $c->detach; } diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 2de3eae5f..60ed216d7 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -829,6 +829,14 @@ sub show_unconfirmed_reports { 0; } +=head2 never_confirm_updates + +If true then we never send an email to confirm an update + +=cut + +sub never_confirm_updates { 0; } + =head2 prettify_dt my $date = $c->prettify_dt( $datetime ); |