aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-06-06 09:20:38 +0100
committerStruan Donald <struan@exo.org.uk>2011-06-06 09:20:38 +0100
commit819a95ae17f59f1732379926f9738caeb9ff046b (patch)
tree743c52675d1738618557f46f853ac46dd8b8530f /perllib/FixMyStreet/App/Controller/Report
parente26bc99396d3eaefc3fd7d81c010dc4028767690 (diff)
parentb388fd0be5296426225089ed188b3c1cdd802415 (diff)
Merge branch 'migrate_to_catalyst' of ssh://git.mysociety.org/data/git/public/fixmystreet into migrate_to_catalyst
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm18
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm13
2 files changed, 25 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 671454272..9e0193d3f 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -931,8 +931,10 @@ sub redirect_or_confirm_creation : Private {
my ( $self, $c ) = @_;
my $report = $c->stash->{report};
- # If confirmed send the user straigh there.
+ # If confirmed send the user straight there.
if ( $report->confirmed ) {
+ # Subscribe problem reporter to email updates
+ $c->forward( 'create_reporter_alert' );
my $report_uri = $c->uri_for( '/report', $report->id );
$c->res->redirect($report_uri);
$c->detach;
@@ -950,6 +952,20 @@ sub redirect_or_confirm_creation : Private {
$c->stash->{email_type} = 'problem';
}
+sub create_reporter_alert : Private {
+ my ( $self, $c ) = @_;
+
+ my $problem = $c->stash->{report};
+ my $alert = $c->model('DB::Alert')->find_or_create( {
+ user => $problem->user,
+ alert_type => 'new_updates',
+ parameter => $problem->id,
+ cobrand => $problem->cobrand,
+ cobrand_data => $problem->cobrand_data,
+ lang => $problem->lang,
+ } )->confirm;
+}
+
=head2 redirect_to_around
Redirect the user to '/around' passing along all the relevant parameters.
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index eadf2beea..a1120470b 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -315,12 +315,15 @@ sub signup_for_alerts : Private {
my ( $self, $c ) = @_;
if ( $c->stash->{add_alert} ) {
+ my $update = $c->stash->{update};
my $alert = $c->model('DB::Alert')->find_or_create(
- user => $c->stash->{update}->user,
- alert_type => 'new_updates',
- parameter => $c->stash->{update}->problem_id,
- confirmed => 1,
- );
+ user => $update->user,
+ alert_type => 'new_updates',
+ parameter => $update->problem_id,
+ cobrand => $update->cobrand,
+ cobrand_data => $update->cobrand_data,
+ lang => $update->lang,
+ )->confirm();
$alert->update;
}