diff options
author | Struan Donald <struan@exo.org.uk> | 2011-05-27 11:24:49 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-05-27 11:24:49 +0100 |
commit | 0c93edcb7b5634f10438d810407b18cb2fa6ba0c (patch) | |
tree | 8b7714cb157ac7b1624e267f750f20716e148220 /perllib/FixMyStreet/App/Controller | |
parent | 4308906bc2695f1fd034b8f5f1a6be657e6d4dfe (diff) |
only confirm alerts on submission if user is logged in
also, tests to make sure we send out emails if a logged in user subscribes with a different address
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Alert.pm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm index db9602ff5..45696e4e7 100644 --- a/perllib/FixMyStreet/App/Controller/Alert.pm +++ b/perllib/FixMyStreet/App/Controller/Alert.pm @@ -194,7 +194,10 @@ sub create_alert : Private { unless ($alert) { $options->{cobrand} = $c->cobrand->moniker(); $options->{cobrand_data} = $c->cobrand->extra_update_data(); - $options->{confirmed} = 1 if $c->stash->{alert_user}->in_storage; + + if ( $c->user && $c->user->id == $c->stash->{alert_user}->id ) { + $options->{confirmed} = 1; + } $alert = $c->model('DB::Alert')->new($options); $alert->insert(); @@ -221,7 +224,6 @@ sub set_update_alert_options : Private { }; $c->stash->{alert_options} = $options; - $c->forward('create_alert'); } =head2 set_local_alert_options @@ -255,7 +257,6 @@ sub set_local_alert_options : Private { push @params, $1, $2; } - my $options = { user => $c->stash->{alert_user}, alert_type => $type |