aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2013-12-17 17:08:18 +0000
committerHakim Cassimally <hakim@mysociety.org>2013-12-17 17:08:18 +0000
commitbdf3f044543a9e2317e86459f4475e3c82b7359c (patch)
treefa620dcbbf935e2a740bf2f44ce36067da4f0298
parent7628dc67ad06a96c2ee18accc8c8b4f4109b1cae (diff)
parentc8447ee320407a0542106cf92d20d72b95452b19 (diff)
Merge branch 'issues/commercial/460-trailing-slashes-on-base-url'
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm4
-rw-r--r--perllib/FixMyStreet/Cobrand/FiksGataMi.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyStreet.pm2
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm7
-rw-r--r--t/app/controller/admin.t11
5 files changed, 21 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index 3fcb449d2..7ba18ed2d 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -149,7 +149,7 @@ sub prepare_params_for_email : Private {
my $problem_url = $base_url . '/report/' . $c->stash->{update}->problem_id
. '#update_' . $c->stash->{update}->id;
- my $admin_url = " - $admin_url" . 'update_edit/' . $c->stash->{update}->id
+ my $admin_url = " - $admin_url" . '/update_edit/' . $c->stash->{update}->id
if $admin_url;
$c->stash->{message} .= sprintf(
" \n\n[ Complaint about update %d on report %d - %s%s ]",
@@ -161,7 +161,7 @@ sub prepare_params_for_email : Private {
elsif ( $c->stash->{problem} ) {
my $problem_url = $base_url . '/report/' . $c->stash->{problem}->id;
- $admin_url = " - $admin_url" . 'report_edit/' . $c->stash->{problem}->id
+ $admin_url = " - $admin_url" . '/report_edit/' . $c->stash->{problem}->id
if $admin_url;
$c->stash->{message} .= sprintf(
" \n\n[ Complaint about report %d - %s%s ]",
diff --git a/perllib/FixMyStreet/Cobrand/FiksGataMi.pm b/perllib/FixMyStreet/Cobrand/FiksGataMi.pm
index 5e90db038..461018639 100644
--- a/perllib/FixMyStreet/Cobrand/FiksGataMi.pm
+++ b/perllib/FixMyStreet/Cobrand/FiksGataMi.pm
@@ -38,7 +38,7 @@ sub area_types {
}
sub admin_base_url {
- return 'http://www.fiksgatami.no/admin/';
+ return 'http://www.fiksgatami.no/admin';
}
# If lat/lon are present in the URL, OpenLayers will use that to centre the map.
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
index aa2be4a0f..c3a1f9d9d 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
@@ -9,7 +9,7 @@ sub restriction {
}
sub admin_base_url {
- return 'https://secure.mysociety.org/admin/bci/';
+ return 'https://secure.mysociety.org/admin/bci';
}
sub title_list {
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index b00daab40..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";
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 4970821a8..e369968b4 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -1228,6 +1228,17 @@ subtest "Test setting a report from unconfirmed to something else doesn't cause
$mech->get_ok("/report/$report_id");
};
+subtest "Check admin_base_url" => sub {
+ my $rs = FixMyStreet::App->model('DB::Problem');
+ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($report->cobrand)->new();
+
+ is (FixMyStreet::App->model('DB::Problem')->get_admin_url(
+ $cobrand,
+ $report),
+ (sprintf 'https://secure.mysociety.org/admin/bci/report_edit/%d', $report_id),
+ 'get_admin_url OK');
+};
+
$mech->delete_user( $user );
$mech->delete_user( $user2 );
$mech->delete_user( $user3 );