aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-05-02 14:34:52 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-05-02 14:34:52 +0100
commit0f8281f5fe419c8ccb76a46e38243f6ab94dda7a (patch)
tree8dbef84deefafc286691784cd9ae3647934f8fe2 /perllib
parent9ddb8c6c990f618e3d65bc4a060f92bce43da7e1 (diff)
parenta344b99a0bf37134079afda51c6f963e1163904b (diff)
Merge branch 'collideoscope-anew'
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Around.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm4
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Nearby.pm5
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm3
-rw-r--r--perllib/FixMyStreet/Map.pm2
5 files changed, 15 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm
index ae7d83f55..bdf381294 100644
--- a/perllib/FixMyStreet/App/Controller/Around.pm
+++ b/perllib/FixMyStreet/App/Controller/Around.pm
@@ -257,12 +257,16 @@ sub map_features : Private {
return if $c->get_param('js'); # JS will request the same (or more) data client side
+ # Allow the cobrand to add in any additional query parameters
+ my $extra_params = $c->cobrand->call_hook('display_location_extra_params');
+
my ( $on_map, $nearby, $distance ) =
FixMyStreet::Map::map_features(
$c, %$extra,
categories => [ keys %{$c->stash->{filter_category}} ],
states => $c->stash->{filter_problem_states},
order => $c->stash->{sort_order},
+ extra => $extra_params,
);
my @pins;
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index e36085d05..3f79a99f7 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -553,8 +553,10 @@ sub nearby_json : Private {
# This is for the list template, this is a list on that page.
$c->stash->{page} = 'report';
+ my $extra_params = $c->cobrand->call_hook('display_location_extra_params');
+
my $nearby = $c->model('DB::Nearby')->nearby(
- $c, $dist, [ $p->id ], 5, $p->latitude, $p->longitude, [ $p->category ], undef
+ $c, $dist, [ $p->id ], 5, $p->latitude, $p->longitude, [ $p->category ], undef, $extra_params
);
# Want to treat these as if they were on map
$nearby = [ map { $_->problem } @$nearby ];
diff --git a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm
index ab554eb9d..b075e3664 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm
@@ -10,7 +10,7 @@ sub to_body {
}
sub nearby {
- my ( $rs, $c, $dist, $ids, $limit, $mid_lat, $mid_lon, $categories, $states ) = @_;
+ my ( $rs, $c, $dist, $ids, $limit, $mid_lat, $mid_lon, $categories, $states, $extra_params ) = @_;
unless ( $states ) {
$states = FixMyStreet::DB::Result::Problem->visible_states();
@@ -27,6 +27,9 @@ sub nearby {
$rs = $c->cobrand->problems_restriction($rs);
+ # Add in any optional extra query parameters
+ $params = { %$params, %$extra_params } if $extra_params;
+
my $attrs = {
prefetch => 'problem',
bind => [ $mid_lat, $mid_lon, $dist ],
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index e262cb63e..ef078ed08 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -176,6 +176,9 @@ sub around_map {
$rs->non_public_if_possible($q, $c);
+ # Add in any optional extra query parameters
+ $q = { %$q, %{$p{extra}} } if $p{extra};
+
my $problems = mySociety::Locale::in_gb_locale {
$rs->search( $q, $attr )->include_comment_counts->page($p{page});
};
diff --git a/perllib/FixMyStreet/Map.pm b/perllib/FixMyStreet/Map.pm
index 91c198913..f5d4c1db6 100644
--- a/perllib/FixMyStreet/Map.pm
+++ b/perllib/FixMyStreet/Map.pm
@@ -104,7 +104,7 @@ sub map_features {
my $limit = 20;
my @ids = map { $_->id } @$on_map;
$nearby = $c->model('DB::Nearby')->nearby(
- $c, $dist, \@ids, $limit, @p{"latitude", "longitude", "categories", "states"}
+ $c, $dist, \@ids, $limit, @p{"latitude", "longitude", "categories", "states", "extra"}
);
}