diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-12-02 17:33:48 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-12-15 17:02:11 +0000 |
commit | 92dfeac83378cd49fbb59591685e5bf849d317e6 (patch) | |
tree | f87175f6539728e319dc5bd027b1b94fd7eaa26b /perllib/FixMyStreet/App/Controller/My.pm | |
parent | 64d24b8627879fc68f9f883d6e24a9c7cb72449f (diff) |
Fix cobrand restriction of My/Nearby.
5c79337 simplified a bit too far, as after then a particular cobrand
could in Nearby and My only filter reports to a particular body, not
any other criteria. To fix this, introduce more generic functions in
the default cobrand to allow more flexibility.
Make sure a few tests delete their bodies fully so that new tests
pass when run as part of the suite.
Fixes #1289.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/My.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/My.pm | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm index 3c4ce2cf7..81a9d7a93 100644 --- a/perllib/FixMyStreet/App/Controller/My.pm +++ b/perllib/FixMyStreet/App/Controller/My.pm @@ -36,6 +36,7 @@ sub my : Path : Args(0) { my $states = $c->stash->{filter_problem_states}; my $params = { state => [ keys %$states ], + user => $c->user->id, }; my $category = $c->get_param('filter_category'); @@ -44,9 +45,7 @@ sub my : Path : Args(0) { $c->stash->{filter_category} = $category; } - my $rs = $c->user->problems - ->to_body($c->cobrand->body_restriction) - ->search( $params, { + my $rs = $c->cobrand->problems->search( $params, { order_by => { -desc => 'confirmed' }, rows => 50 } )->page( $p_page ); @@ -77,7 +76,7 @@ sub my : Path : Args(0) { $c->stash->{updates} = \@updates; $c->stash->{updates_pager} = $rs->pager; - my @categories = $c->user->problems->search( undef, { + my @categories = $c->cobrand->problems->search( { user => $c->user->id }, { columns => [ 'category' ], distinct => 1, order_by => [ 'category' ], |