diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Alert.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Alert.pm | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm index 755602562..f93231235 100644 --- a/perllib/FixMyStreet/App/Controller/Alert.pm +++ b/perllib/FixMyStreet/App/Controller/Alert.pm @@ -58,12 +58,15 @@ sub subscribe : Path('subscribe') : Args(0) { $c->detach('rss') if $c->get_param('rss'); + my $id = $c->get_param('id'); + $c->forward('/report/load_problem_or_display_error', [ $id ]) if $id; + # if it exists then it's been submitted so we should # go to subscribe email and let it work out the next step $c->detach('subscribe_email') if $c->get_param('rznvy') || $c->get_param('alert'); - $c->go('updates') if $c->get_param('id'); + $c->go('updates') if $id; # shouldn't get to here but if we have then do something sensible $c->go('index'); @@ -211,13 +214,10 @@ Set up the options in the stash required to create a problem update alert sub set_update_alert_options : Private { my ( $self, $c ) = @_; - my $report_id = $c->get_param('id'); - return unless $report_id =~ /^[1-9]\d*$/; - my $options = { user => $c->stash->{alert_user}, alert_type => 'new_updates', - parameter => $report_id, + parameter => $c->stash->{problem}->id, }; $c->stash->{alert_options} = $options; @@ -344,12 +344,8 @@ sub process_user : Private { return; } - # Extract all the params to a hash to make them easier to work with - my %params = map { $_ => $c->get_param($_) } - ( 'rznvy' ); # , 'password_register' ); - - # cleanup the email address - my $email = $params{rznvy} ? lc $params{rznvy} : ''; + my $email = $c->get_param('rznvy'); + $email = $email ? lc $email : ''; $email =~ s{\s+}{}g; push @{ $c->stash->{errors} }, _('Please enter a valid email address') @@ -357,19 +353,6 @@ sub process_user : Private { my $alert_user = $c->model('DB::User')->find_or_new( { email => $email } ); $c->stash->{alert_user} = $alert_user; - -# # The user is trying to sign in. We only care about email from the params. -# if ( $c->get_param('submit_sign_in') ) { -# unless ( $c->forward( '/auth/sign_in', [ $email ] ) ) { -# $c->stash->{field_errors}->{password} = _('There was a problem with your email/password combination. Please try again.'); -# return 1; -# } -# my $user = $c->user->obj; -# $c->stash->{alert_user} = $user; -# return 1; -# } -# -# $alert_user->password( $params{password_register} ); } =head2 setup_coordinate_rss_feeds |