diff options
author | Struan Donald <struan@exo.org.uk> | 2011-05-11 14:55:39 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-05-11 14:55:39 +0100 |
commit | c3adef1dea602a181521f2bc0848ec47d67198d0 (patch) | |
tree | e65bb2ac57e92d8501dff147516855c4853ac873 /perllib/FixMyStreet/App/Controller/Alert.pm | |
parent | a20a64f50fa01c7e3604c5dc329db2c4a607682d (diff) |
moving alerts to use users instead of email in table
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Alert.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Alert.pm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm index 742aa6c1d..595f6d252 100644 --- a/perllib/FixMyStreet/App/Controller/Alert.pm +++ b/perllib/FixMyStreet/App/Controller/Alert.pm @@ -243,8 +243,11 @@ sub subscribe_email : Private { # return alert_front_page($q, @errors); } - my $alert; my $email = $c->req->param('rznvy'); + $c->stash->{email} = $email; + $c->forward( 'process_user' ); + + my $alert; # my $cobrand = Page::get_cobrand($q); # my $cobrand_data = Cobrand::extra_alert_data($cobrand, $q); @@ -286,7 +289,7 @@ sub subscribe_email : Private { } my $options = { - email => $email, + user => $c->stash->{alert_user}, alert_type => $type }; @@ -440,6 +443,14 @@ sub council_options : Private { } } +sub process_user : Private { + my ( $self, $c ) = @_; + + my $email = $c->stash->{email}; + my $alert_user = $c->model('DB::User')->find_or_new( { email => $email } ); + $c->stash->{alert_user} = $alert_user; +} + sub choose : Private { my ( $self, $c ) = @_; $c->stash->{template} = 'alert/choose.html'; |