From cbfe33690c64f6a301e77971abb9b762318bb9be Mon Sep 17 00:00:00 2001 From: Hakim Cassimally Date: Wed, 11 Dec 2013 17:47:02 +0000 Subject: Rationalise trailing slashes from admin_base_url Remove from admin_base_url (which wraps config vars like {ADMIN_,}BASE_URL) and add to places in code which aren't expecting it. --- perllib/FixMyStreet/DB/ResultSet/Problem.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/DB/ResultSet/Problem.pm') diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index b00daab40..603f425f7 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -278,7 +278,7 @@ sub send_reports { $h{query} = $row->postcode; $h{url} = $email_base_url . $row->url; - $h{admin_url} = $cobrand->admin_base_url . 'report_edit/' . $row->id; + $h{admin_url} = $cobrand->admin_base_url . '/report_edit/' . $row->id; $h{phone_line} = $h{phone} ? _('Phone:') . " $h{phone}\n\n" : ''; if ($row->photo) { $h{has_photo} = _("This web page also contains a photo of the problem, provided by the user.") . "\n\n"; -- cgit v1.2.3 From c8447ee320407a0542106cf92d20d72b95452b19 Mon Sep 17 00:00:00 2001 From: Hakim Cassimally Date: Tue, 17 Dec 2013 14:46:31 +0000 Subject: Test for admin_base_url in RS::Problem Test that the slash is added in correct place (the base URL should not have its own trailing slash). --- perllib/FixMyStreet/DB/ResultSet/Problem.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/DB/ResultSet/Problem.pm') diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 603f425f7..3bf41035e 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -216,6 +216,11 @@ sub categories_summary { return \%categories; } +sub get_admin_url { + my ($rs, $cobrand, $row) = @_; + return $cobrand->admin_base_url . '/report_edit/' . $row->id; +} + sub send_reports { my ( $rs, $site_override ) = @_; @@ -278,7 +283,7 @@ sub send_reports { $h{query} = $row->postcode; $h{url} = $email_base_url . $row->url; - $h{admin_url} = $cobrand->admin_base_url . '/report_edit/' . $row->id; + $h{admin_url} = $rs->get_admin_url($cobrand, $row); $h{phone_line} = $h{phone} ? _('Phone:') . " $h{phone}\n\n" : ''; if ($row->photo) { $h{has_photo} = _("This web page also contains a photo of the problem, provided by the user.") . "\n\n"; -- cgit v1.2.3