-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FMS] Make sure contributed_by recorded if not logged in
contributed_by is now set if a user logs in during report making process. Results in dashboard report now showing roles filter correctly when staff user logs in as part of report making process. mysociety/societyworks#4234
- Loading branch information
1 parent
818a840
commit acf3c69
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,7 +125,28 @@ my $parks_contact2 = $mech->create_contact_ok(body_id => $brent->id, category => | |
my $parks_contact3 = $mech->create_contact_ok(body_id => $brent->id, category => 'Ponds', | ||
email => '[email protected]', group => 'Parks and open spaces'); | ||
my $user1 = $mech->create_user_ok('[email protected]', email_verified => 1, name => 'User 1'); | ||
my $role = FixMyStreet::DB->resultset("Role")->create({ | ||
body => $brent, | ||
name => 'Role', | ||
permissions => ['moderate', 'user_edit'], | ||
}); | ||
my $staff_user = $mech->create_user_ok('[email protected]', from_body => $brent, name => 'Staff User'); | ||
$staff_user->user_roles->find_or_create({ role_id => $role->id }); | ||
|
||
subtest 'role report shows staff problem when staff logged in during problem reporting process' => sub { | ||
FixMyStreet::override_config { | ||
ALLOWED_COBRANDS => ['brent'], | ||
MAPIT_URL => 'http://mapit.uk/', | ||
}, sub { | ||
$mech->get_ok("/report/new?longitude=-0.28168&latitude=51.55904"); | ||
$mech->submit_form_ok( { with_fields => { category => 'Graffiti', title => 'Spraypaint on wall', detail => 'Some kind of picture', name => 'Staff User', username_register => $mech->uniquify_email('[email protected]') } }, 'Staff user logs in whilst making report' ); | ||
$mech->get_ok($mech->get_link_from_email($mech->get_email)); | ||
$mech->get_ok('/dashboard?body=' . $brent->id . '&state=&role=' . $role->id . '&start_date=&end_date=&group_by=category+state&export=1'); | ||
$mech->content_contains('"Spraypaint on wall","Some kind of picture"', 'Report has contributed_by set and so shows in roles report'); | ||
$mech->clear_emails_ok; | ||
$mech->log_out_ok; | ||
}; | ||
}; | ||
|
||
# Add location_name field to parks categories | ||
for my $contact ($parks_contact, $parks_contact2, $parks_contact3) { | ||
|