aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/ResultSet/Body.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-10-10 13:16:12 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-10-10 13:21:36 +0100
commitf8a4d8f97dfc2e61854bb423594e669de7e63aef (patch)
treea42d9c5808fa6806454deaee9436f892de160750 /perllib/FixMyStreet/DB/ResultSet/Body.pm
parent8f99184aec230770c62237e060bc9af02b06a3e6 (diff)
Have body.url work in hashref lookup.
body.url could still be in use by old-school /reports table index pages (though they were dropped in 2.1, so a cobrand would have to have overridden it since then) and the update to speed up body lists in #2248 broke it. This puts it back in minimal form.
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Body.pm')
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Body.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Body.pm b/perllib/FixMyStreet/DB/ResultSet/Body.pm
index 1855a45c1..4e9661d2e 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Body.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Body.pm
@@ -149,9 +149,17 @@ sub all_sorted {
})->all;
@bodies = sort { strcoll($a->{msgstr} || $a->{name}, $b->{msgstr} || $b->{name}) } @bodies;
+ my $cobrand = $rs->result_source->schema->cobrand;
+
foreach my $body (@bodies) {
$body->{parent} = { id => $body->{parent}, name => $body->{parent_name} } if $body->{parent};
+ # DEPRECATED: url(c, query_params) -> url
+ $body->{url} = sub {
+ my ($c, $args) = @_;
+ return FixMyStreet::DB::Result::Body::_url($body, $cobrand, $args);
+ };
+
# DEPRECATED: get_column('area_count') -> area_count
next unless defined $body->{area_count};
$body->{get_column} = sub {