diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-06-03 20:21:13 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-06-03 20:21:13 +0100 |
commit | 5d2261eb81e9e28bbaa1f52c668be164bb7a597d (patch) | |
tree | 8144a0b47cff3fa3bc4a7dfd090d55162191174d /perllib/FixMyStreet/App/Controller/Alert.pm | |
parent | 5e3cc91d5c7cb3c48418cf26064de2ba214e6567 (diff) |
Sign up new report to email alert if logged in as well as when confirmed by email. Allow disabling rather than deleting of alerts. Revert quoting as it breaks timestamps and literal SQL.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Alert.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Alert.pm | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm index bea5345e3..70a86a936 100644 --- a/perllib/FixMyStreet/App/Controller/Alert.pm +++ b/perllib/FixMyStreet/App/Controller/Alert.pm @@ -140,7 +140,7 @@ sub subscribe_email : Private { $c->forward('set_local_alert_options'); } else { - throw FixMyStreet::Alert::Error('Invalid type'); + $c->detach( '/page_error_404_not_found', [ 'Invalid type' ] ); } $c->forward('create_alert'); @@ -162,7 +162,7 @@ sub updates : Path('updates') : Args(0) { =head2 confirm -Confirm signup to an alert. Forwarded here from Tokens. +Confirm signup to or unsubscription from an alert. Forwarded here from Tokens. =cut @@ -173,11 +173,9 @@ sub confirm : Private { if ( $c->stash->{confirm_type} eq 'subscribe' ) { $alert->confirm(); - $alert->update; } elsif ( $c->stash->{confirm_type} eq 'unsubscribe' ) { - $alert->delete(); - $alert->update; + $alert->disable(); } } @@ -198,6 +196,7 @@ sub create_alert : Private { unless ($alert) { $options->{cobrand} = $c->cobrand->moniker(); $options->{cobrand_data} = $c->cobrand->extra_update_data(); + $options->{lang} = $c->stash->{lang_code}; if ( $c->user && $c->user->id == $c->stash->{alert_user}->id ) { $options->{confirmed} = 1; |