aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2015-12-17 07:53:47 +0000
committerMatthew Somerville <matthew@mysociety.org>2015-12-17 07:53:47 +0000
commit7955472909243a80f395d90b93254b53b16de34d (patch)
tree1c5d634c3dc28fefd1b59da23d15d522fa5eabc1
parentcbdfcad63e598447c318ce78738d477383f273d7 (diff)
Fix bug showing reports on Your Reports.
92dfeac used an incorrect user column name in the new lookup, and there was no test to catch the regression.
-rw-r--r--perllib/FixMyStreet/App/Controller/My.pm4
-rw-r--r--t/app/controller/my.t7
2 files changed, 8 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm
index 81a9d7a93..8eb7f079e 100644
--- a/perllib/FixMyStreet/App/Controller/My.pm
+++ b/perllib/FixMyStreet/App/Controller/My.pm
@@ -36,7 +36,7 @@ sub my : Path : Args(0) {
my $states = $c->stash->{filter_problem_states};
my $params = {
state => [ keys %$states ],
- user => $c->user->id,
+ user_id => $c->user->id,
};
my $category = $c->get_param('filter_category');
@@ -76,7 +76,7 @@ sub my : Path : Args(0) {
$c->stash->{updates} = \@updates;
$c->stash->{updates_pager} = $rs->pager;
- my @categories = $c->cobrand->problems->search( { user => $c->user->id }, {
+ my @categories = $c->cobrand->problems->search( { user_id => $c->user->id }, {
columns => [ 'category' ],
distinct => 1,
order_by => [ 'category' ],
diff --git a/t/app/controller/my.t b/t/app/controller/my.t
index b723e537e..d24a66c8e 100644
--- a/t/app/controller/my.t
+++ b/t/app/controller/my.t
@@ -9,12 +9,17 @@ my $mech = FixMyStreet::TestMech->new;
$mech->get_ok('/my');
is $mech->uri->path, '/auth', "got sent to the sign in page";
+$mech->create_problems_for_body(1, 1234, 'Test Title');
+
# sign in
my $user = $mech->log_in_ok( 'test@example.com' );
$mech->get_ok('/my');
is $mech->uri->path, '/my', "stayed on '/my/' page";
+# Report listed
+$mech->content_contains('Test Title');
+
# cleanup
$mech->delete_user( $user );
-
+$mech->delete_problems_for_body(1234);
done_testing();