aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App.pm5
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm20
-rw-r--r--perllib/FixMyStreet/Cobrand/EmptyHomes.pm5
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/AlertType.pm6
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm2
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm2
-rw-r--r--perllib/Open311.pm2
-rw-r--r--t/app/model/alert_type.t4
9 files changed, 12 insertions, 36 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 2f199f4bf..9553aafa2 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -387,11 +387,10 @@ and uses that.
=cut
sub uri_for_email {
- my $c = shift;
- my @args = @_;
+ my $c = shift;
my $normal_uri = $c->uri_for(@_)->absolute;
- my $base = $c->cobrand->base_url_with_lang( 1 );
+ my $base = $c->cobrand->base_url_with_lang;
my $email_uri = $base . $normal_uri->path_query;
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index c300aee9a..8b98f57c9 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -139,7 +139,7 @@ sub prepare_params_for_email : Private {
$c->stash->{message} =~ s/\r\n/\n/g;
$c->stash->{subject} =~ s/\r|\n/ /g;
- my $base_url = $c->cobrand->base_url_for_emails( $c->cobrand->extra_data );
+ my $base_url = $c->cobrand->base_url( $c->cobrand->extra_data );
my $admin_url = $c->cobrand->admin_base_url;
if ( $c->stash->{update} ) {
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 3c6d6b273..e08e3c514 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -65,31 +65,13 @@ sub restriction {
return $self->moniker ? { cobrand => $self->moniker } : {};
}
-=head2 base_url_for_emails
-
-Return the base url to use in links in emails for the cobranded version of the
-site, parameter is extra data.
-
-=cut
-
-sub base_url_for_emails {
- my $self = shift;
- return $self->base_url;
-}
-
=head2 base_url_with_lang
=cut
sub base_url_with_lang {
my $self = shift;
- my $email = shift;
-
- if ($email) {
- return $self->base_url_for_emails;
- } else {
- return $self->base_url;
- }
+ return $self->base_url;
}
=head2 admin_base_url
diff --git a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm
index 6885f6a95..ecb3358bb 100644
--- a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm
+++ b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm
@@ -33,14 +33,9 @@ sub area_types {
sub base_url_with_lang {
my $self = shift;
- my $email = shift;
my $base = $self->base_url;
- if ($email) {
- $base = $self->base_url_for_emails;
- }
-
my $lang = $mySociety::Locale::lang;
if ($lang eq 'cy') {
$base =~ s{http://}{$&cy.};
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
index 981b8e8f7..5231d01ef 100644
--- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
@@ -85,7 +85,7 @@ sub email_alerts ($) {
$data{state_message} = _("This report is currently marked as open.");
}
- my $url = $cobrand->base_url_for_emails( $row->{alert_cobrand_data} );
+ my $url = $cobrand->base_url( $row->{alert_cobrand_data} );
if ( $hashref_restriction && $hashref_restriction->{council} && $row->{council} ne $hashref_restriction->{council} ) {
$url = mySociety::Config::get('BASE_URL');
}
@@ -164,7 +164,7 @@ sub email_alerts ($) {
alert_id => $alert->id,
parameter => $row->{id},
} );
- my $url = $cobrand->base_url_for_emails( $alert->cobrand_data );
+ my $url = $cobrand->base_url( $alert->cobrand_data );
if ( $hashref_restriction && $hashref_restriction->{council} && $row->{council} ne $hashref_restriction->{council} ) {
$url = mySociety::Config::get('BASE_URL');
}
@@ -203,7 +203,7 @@ sub _send_aggregated_alert_email(%) {
email => $data{alert_email},
}
} );
- $data{unsubscribe_url} = $cobrand->base_url_for_emails( $data{cobrand_data} ) . '/A/' . $token->token;
+ $data{unsubscribe_url} = $cobrand->base_url( $data{cobrand_data} ) . '/A/' . $token->token;
my $template = FixMyStreet->path_to(
"templates", "email", $cobrand->moniker, $data{lang}, "$data{template}.txt"
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index a689e80a9..370c15913 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -250,7 +250,7 @@ sub send_reports {
}
# Template variables for the email
- my $email_base_url = $cobrand->base_url_for_emails($row->cobrand_data);
+ my $email_base_url = $cobrand->base_url($row->cobrand_data);
my %h = map { $_ => $row->$_ } qw/id title detail name category latitude longitude used_map/;
map { $h{$_} = $row->user->$_ } qw/email phone/;
$h{confirmed} = DateTime::Format::Pg->format_datetime( $row->confirmed->truncate (to => 'second' ) );
diff --git a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
index 753eb2084..bbf0c9a9e 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
@@ -85,7 +85,7 @@ sub send_questionnaires_period {
scope => 'questionnaire',
data => $questionnaire->id,
} );
- $h{url} = $cobrand->base_url_for_emails($row->cobrand_data) . '/Q/' . $token->token;
+ $h{url} = $cobrand->base_url($row->cobrand_data) . '/Q/' . $token->token;
my $sender = $cobrand->contact_email;
my $sender_name = _($cobrand->contact_name);
diff --git a/perllib/Open311.pm b/perllib/Open311.pm
index fd6a67706..e29971612 100644
--- a/perllib/Open311.pm
+++ b/perllib/Open311.pm
@@ -280,7 +280,7 @@ sub _populate_service_request_update_params {
if ( $comment->photo ) {
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($comment->cobrand)->new();
- my $email_base_url = $cobrand->base_url_for_emails($comment->cobrand_data);
+ my $email_base_url = $cobrand->base_url($comment->cobrand_data);
my $url = $email_base_url . '/photo/c/' . $comment->id . '.full.jpeg';
$params->{media_url} = $url;
}
diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t
index c23252de6..272ad4900 100644
--- a/t/app/model/alert_type.t
+++ b/t/app/model/alert_type.t
@@ -448,7 +448,7 @@ subtest "check alerts from cobrand send main site url for alerts for different c
my $expected1 = mySociety::Config::get('BASE_URL') . '/report/' . $report_to_county_council->id;
my $expected3 = mySociety::Config::get('BASE_URL') . '/report/' . $report_outside_district->id;
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('lichfielddc')->new();
- my $expected2 = $cobrand->base_url_for_emails . '/report/' . $report_to_council->id;
+ my $expected2 = $cobrand->base_url . '/report/' . $report_to_council->id;
like $body, qr#$expected1#, 'non cobrand area report point to fixmystreet.com';
like $body, qr#$expected2#, 'cobrand area report point to cobrand url';
@@ -485,7 +485,7 @@ subtest "check local alerts from cobrand send main site url for alerts for diffe
my $expected1 = mySociety::Config::get('BASE_URL') . '/report/' . $report_to_county_council->id;
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('lichfielddc')->new();
- my $expected2 = $cobrand->base_url_for_emails . '/report/' . $report_to_council->id;
+ my $expected2 = $cobrand->base_url . '/report/' . $report_to_council->id;
like $body, qr#$expected1#, 'non cobrand area report point to fixmystreet.com';
like $body, qr#$expected2#, 'cobrand area report point to cobrand url';