aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Alert.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-05-11 11:37:36 +0100
committerStruan Donald <struan@exo.org.uk>2011-05-11 11:37:36 +0100
commit5f1db7700255e00ce492d57939f861f76b6ddadf (patch)
treeefa957abee5ae5fc36b9d3be871ec1f18ba92465 /perllib/FixMyStreet/App/Controller/Alert.pm
parent4bb7f2af6a5a2e5f401d47f8aa2291000f95a641 (diff)
confirm alert subscription
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Alert.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Alert.pm24
1 files changed, 23 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm
index 12624b8f2..742aa6c1d 100644
--- a/perllib/FixMyStreet/App/Controller/Alert.pm
+++ b/perllib/FixMyStreet/App/Controller/Alert.pm
@@ -298,7 +298,7 @@ sub subscribe_email : Private {
$options->{parameter2} = $params[1];
}
- $alert = $c->model('DB::Alert')->find( $options );
+ $alert = $c->model('DB::Alert')->find($options);
unless ($alert) {
$options->{cobrand} = $c->cobrand->moniker();
@@ -335,6 +335,28 @@ sub subscribe_email : Private {
);
}
+=head2 confirm
+
+Confirm signup to an alert
+
+=cut
+
+sub confirm : Private {
+ my ( $self, $c ) = @_;
+
+ my $alert = $c->stash->{alert};
+ $c->stash->{template} = 'alert/confirm.html';
+
+ if ( $c->stash->{confirm_type} eq 'subscribe' ) {
+ $alert->confirm();
+ $alert->update;
+ }
+ elsif ( $c->stash->{confirm_type} eq 'unsubscribe' ) {
+ $alert->delete();
+ $alert->update;
+ }
+}
+
=head2 prettify_pc
This will canonicalise and prettify the postcode and stick a pretty_pc and pretty_pc_text in the stash.