diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2015-09-01 10:07:30 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-09-03 16:14:18 +0100 |
commit | 8544bafc365406ac9a403e80fe07cc361a7d1d5b (patch) | |
tree | da90a4a20c9f3d653335b3c8369b900211b47dd0 /perllib/FixMyStreet/DB | |
parent | 8ef9368785c1950ae0aea8c13584288d395662d6 (diff) |
Use base URL in cobrand alert for no-body report.
If a cobrand has a body restriction, then a report without any body
won't be shown on it, so we need to make sure links to the report (in
email alerts and RSS) are to the base URL, not the cobrand.
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/AlertType.pm | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm index e59011ba9..25c727e25 100644 --- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm +++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm @@ -88,11 +88,7 @@ sub email_alerts ($) { $data{state_message} = _("This report is currently marked as open."); } - my $hashref_restriction = $cobrand->body_restriction; - my $url = $cobrand->base_url( $row->{alert_cobrand_data} ); - if ( $hashref_restriction && $row->{bodies_str} ne $hashref_restriction ) { - $url = mySociety::Config::get('BASE_URL'); - } + my $url = $cobrand->base_url_for_report($row); # this is currently only for new_updates if ($row->{item_text}) { if ( $cobrand->moniker ne 'zurich' && $row->{alert_user_id} == $row->{user_id} ) { @@ -171,7 +167,6 @@ sub email_alerts ($) { my $longitude = $alert->parameter; my $latitude = $alert->parameter2; - my $hashref_restriction = $cobrand->body_restriction; my $d = mySociety::Gaze::get_radius_containing_population($latitude, $longitude, 200000); # Convert integer to GB locale string (with a ".") $d = mySociety::Locale::in_gb_locale { @@ -195,10 +190,7 @@ sub email_alerts ($) { alert_id => $alert->id, parameter => $row->{id}, } ); - my $url = $cobrand->base_url( $alert->cobrand_data ); - if ( $hashref_restriction && $row->{bodies_str} ne $hashref_restriction ) { - $url = mySociety::Config::get('BASE_URL'); - } + my $url = $cobrand->base_url_for_report($row); $data{data} .= $url . "/report/" . $row->{id} . " - $row->{title}\n\n"; if ( exists $row->{geocode} && $row->{geocode} ) { my $nearest_st = _get_address_from_gecode( $row->{geocode} ); |