aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2019-03-01 17:04:50 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2019-03-05 13:08:51 +0000
commitc029ec15c481cfe153670c735a1d4ca35b3153f9 (patch)
tree774ec135781366875045eb1f218ae9f03310cc14 /perllib
parent86827c23436fef52b6b38d3fbc357fb0bf20f0c6 (diff)
Use relative report links where possible.
On some UK council cobrands, some reports listed might not have been sent to that council, so links to those must go to the national site. However, using absolute URLs for all these reports means that sometimes you change domain when you don't need to (eg. if you’re on osm.fixmystreet.com or an aliased version of the site), which can cause confusion. State when we’re happy to use a relative link (ie. web-facing report links, not emails, or share links) and do that when we can.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm12
-rw-r--r--perllib/FixMyStreet/Cobrand/UKCouncils.pm5
2 files changed, 17 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 4c5d29ee5..e54d85aa7 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -237,6 +237,18 @@ sub base_url_for_report {
return $self->base_url_with_lang;
}
+=item relative_url_for_report
+
+Returns the relative base url for a report (might be different in a two-tier
+county, but normally blank). Report may be an object, or a hashref.
+
+=cut
+
+sub relative_url_for_report {
+ my ( $self, $report ) = @_;
+ return "";
+}
+
=item base_host
Return the base host for the cobranded version of the site
diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
index ab3d8f91b..1beafef73 100644
--- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm
+++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
@@ -204,6 +204,11 @@ sub base_url_for_report {
}
}
+sub relative_url_for_report {
+ my ( $self, $report ) = @_;
+ return $self->owns_problem($report) ? "" : FixMyStreet->config('BASE_URL');
+}
+
sub admin_allow_user {
my ( $self, $user ) = @_;
return 1 if $user->is_superuser;