aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Alert.pm
diff options
context:
space:
mode:
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.