diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 | ||||
-rw-r--r-- | t/app/controller/report_new_anon.t | 55 | ||||
-rw-r--r-- | templates/web/base/alert/index.html | 2 | ||||
-rw-r--r-- | templates/web/base/around/postcode_form.html | 2 | ||||
-rwxr-xr-x | templates/web/fixmystreet.com/about/faq-en-gb.html | 2 | ||||
-rw-r--r-- | templates/web/oxfordshire/around/postcode_form.html | 2 |
6 files changed, 61 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index c50093f23..c41b65e2a 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -975,6 +975,8 @@ sub process_report : Private { my $anon_button = $c->cobrand->allow_anonymous_reports eq 'button' && $c->get_param('report_anonymously'); if ($anon_button) { $c->stash->{contributing_as_anonymous_user} = 1; + $c->stash->{contributing_as_body} = undef; + $c->stash->{contributing_as_another_user} = undef; } # set some simple bool values (note they get inverted) diff --git a/t/app/controller/report_new_anon.t b/t/app/controller/report_new_anon.t index e9ce23c44..e1acb202c 100644 --- a/t/app/controller/report_new_anon.t +++ b/t/app/controller/report_new_anon.t @@ -20,6 +20,17 @@ END { FixMyStreet::App->log->enable('info'); } my $mech = FixMyStreet::TestMech->new; my $body = $mech->create_body_ok(2651, 'Edinburgh'); +my $staffuser = $mech->create_user_ok('counciluser@example.com', name => 'Council User', from_body => $body); +$staffuser->user_body_permissions->create({ + body => $body, + permission_type => 'contribute_as_body', +}); +$staffuser->user_body_permissions->create({ + body => $body, + permission_type => 'default_to_body', +}); + + my $contact1 = $mech->create_contact_ok( body_id => $body->id, category => 'Street lighting', @@ -148,6 +159,7 @@ subtest "test report creation anonymously by button" => sub { is $report->bodies_str, $body->id; is $report->name, 'Anonymous Button'; is $report->anonymous, 1; # Doesn't change behaviour here, but uses anon account's name always + is $report->get_extra_metadata('contributed_as'), 'anonymous_user'; my $alert = FixMyStreet::App->model('DB::Alert')->find( { user => $report->user, @@ -159,6 +171,49 @@ subtest "test report creation anonymously by button" => sub { $mech->not_logged_in_ok; }; +subtest "test report creation anonymously by staff user" => sub { + FixMyStreet::DB->resultset("Problem")->delete_all; + + $mech->log_in_ok( $staffuser->email ); + $mech->get_ok('/around'); + $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } }, "submit location" ); + $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" ); + $mech->submit_form_ok( + { + button => 'report_anonymously', + with_fields => { + title => 'Test Report', + detail => 'Test report details.', + category => 'Street lighting', + } + }, + "submit good details" + ); + $mech->content_contains('Thank you'); + + is_deeply $mech->page_errors, [], "check there were no errors"; + + my $report = FixMyStreet::DB->resultset("Problem")->first; + ok $report, "Found the report"; + + is $report->state, 'confirmed', "report confirmed"; + $mech->get_ok( '/report/' . $report->id ); + + is $report->bodies_str, $body->id; + is $report->name, 'Anonymous Button'; + is $report->anonymous, 1; + is $report->get_extra_metadata('contributed_as'), 'anonymous_user'; + + my $alert = FixMyStreet::App->model('DB::Alert')->find( { + user => $report->user, + alert_type => 'new_updates', + parameter => $report->id, + } ); + is $alert, undef, "no alert created"; + + $mech->log_out_ok; +}; + }; done_testing(); diff --git a/templates/web/base/alert/index.html b/templates/web/base/alert/index.html index fa6e01fad..ba3c64baf 100644 --- a/templates/web/base/alert/index.html +++ b/templates/web/base/alert/index.html @@ -37,7 +37,7 @@ within a certain distance of a particular location.', "%s is the site name"), si <input class="green-btn" type="submit" value="[% loc('Go') %]"> </div> </fieldset> - <a href="/alert/list" id="geolocate_link">… [% loc('or locate me automatically') %]</a> + <a href="/alert/list" id="geolocate_link">… [% loc('or use my location') %]</a> </form> [% IF photos.size %] diff --git a/templates/web/base/around/postcode_form.html b/templates/web/base/around/postcode_form.html index 0921fa496..e3f03b203 100644 --- a/templates/web/base/around/postcode_form.html +++ b/templates/web/base/around/postcode_form.html @@ -31,7 +31,7 @@ IF c.get_param('filter_category'); link_params.filter_category = c.get_param('filter_category'); END; IF c.get_param('filter_group'); link_params.filter_group = c.get_param('filter_group'); END; %] - <a href="[% c.uri_for('/around', link_params) | html %]" id="geolocate_link">… [% loc('or locate me automatically') %]</a> + <a href="[% c.uri_for('/around', link_params) | html %]" id="geolocate_link">… [% loc('or use my location') %]</a> [% UNLESS possible_location_matches %] [% INCLUDE 'around/_postcode_form_post.html' %] diff --git a/templates/web/fixmystreet.com/about/faq-en-gb.html b/templates/web/fixmystreet.com/about/faq-en-gb.html index f5f3019ea..039dc7c98 100755 --- a/templates/web/fixmystreet.com/about/faq-en-gb.html +++ b/templates/web/fixmystreet.com/about/faq-en-gb.html @@ -60,7 +60,7 @@ browser – it should work well. <dd> <ol> <li>Start at the <a href="/">homepage</a> and type in your postcode or a place -name. Not sure where you are? Pick ‘locate me automatically’. +name. Not sure where you are? Pick ‘use my location’. <li>Put the pin in the map to show exactly where the problem is, and type in a description of the issue. Then send. <li>Check your email inbox for our confirmation mail, click on the link, and diff --git a/templates/web/oxfordshire/around/postcode_form.html b/templates/web/oxfordshire/around/postcode_form.html index c6028e7d6..ea15809d8 100644 --- a/templates/web/oxfordshire/around/postcode_form.html +++ b/templates/web/oxfordshire/around/postcode_form.html @@ -25,7 +25,7 @@ <input type="hidden" name="filter_category" value="[% c.user.categories.join(",") | html %]"> [% END %] </form> - <a href="[% c.uri_for('/around') %]" id="geolocate_link">[% loc('Or locate me automatically') %]</a> + <a href="[% c.uri_for('/around') %]" id="geolocate_link">[% loc('Or use my location') %]</a> [% UNLESS possible_location_matches %] [% INCLUDE 'around/_postcode_form_post.html' %] |