aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm12
-rw-r--r--perllib/FixMyStreet/App/Controller/My.pm7
2 files changed, 7 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 9a6c7bded..0fc87c2f6 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -84,7 +84,7 @@ sub index : Path : Args(0) {
for ( FixMyStreet::DB::Result::Problem->visible_states() );
$c->stash->{total_problems_users} = $c->cobrand->problems->unique_users;
- my $comments = $c->model('DB::Comment')->summary_count( $c->cobrand->body_restriction );
+ my $comments = $c->cobrand->updates->summary_count;
my %comment_counts =
map { $_->state => $_->get_column('state_count') } $comments->all;
@@ -171,7 +171,7 @@ sub timeline : Path( 'timeline' ) : Args(0) {
push @{$time{$_->whenanswered->epoch}}, { type => 'quesAnswered', date => $_->whenanswered, obj => $_ } if $_->whenanswered;
}
- my $updates = $c->model('DB::Comment')->timeline( $c->cobrand->body_restriction );
+ my $updates = $c->cobrand->updates->timeline;
foreach ($updates->all) {
push @{$time{$_->created->epoch}}, { type => 'update', date => $_->created, obj => $_} ;
@@ -622,9 +622,7 @@ sub reports : Path('reports') {
}
if (@$query) {
- my $updates = $c->model('DB::Comment')
- ->to_body($c->cobrand->body_restriction)
- ->search(
+ my $updates = $c->cobrand->updates->search(
{
-or => $query,
},
@@ -967,9 +965,7 @@ sub users: Path('users') : Args(0) {
sub update_edit : Path('update_edit') : Args(1) {
my ( $self, $c, $id ) = @_;
- my $update = $c->model('DB::Comment')
- ->to_body($c->cobrand->body_restriction)
- ->search({ id => $id })->first;
+ my $update = $c->cobrand->updates->search({ id => $id })->first;
$c->detach( '/page_error_404_not_found' )
unless $update;
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' ],