aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/Update.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2014-03-19 12:26:18 +0000
committerStruan Donald <struan@exo.org.uk>2014-04-08 13:21:11 +0100
commitf0c1e25cd4774996d6e523bdad73ae3d8f6cabae (patch)
treef37f4a6df7e372624d83aaccd6c6218dde9903e5 /perllib/FixMyStreet/App/Controller/Report/Update.pm
parent96a2bb583e614cdd721909ebff21f3c1522e1024 (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/FixMyStreet/App/Controller/Report/Update.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm10
1 files changed, 9 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;
}