Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make anonymous comments clearer in alert emails #3417

Merged
merged 2 commits into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Improve `#geolocate_link` display, especially for smaller screens. #2048
- Allow email alert radius to be specified. #68
- Update URL on /my when map moves. #3358
- Make anonymous updates clearer in email alerts. #3417
- Bugfixes:
- Fix non-JS form when all extra questions answered. #3248
- Improve display of disabled fields in iOS.
Expand All @@ -33,6 +34,7 @@
- Development improvements:
- Include failure count in send report error output, #3316
- Sort output in export script. #3323
- Show relevant updates in alert-update email preview. #3417
- Open311 improvements:
- Consistent protected field ordering.
- Security:
Expand Down
7 changes: 6 additions & 1 deletion perllib/FixMyStreet/App/Controller/Develop.pm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ sub email_previewer : Path('/_dev/email') : Args(1) {
$vars->{data} = [ $c->model('DB::Problem')->search({}, { rows => 5 })->all ];
} elsif ($template eq 'alert-update') {
$vars->{data} = [];
my $q = $c->model('DB::Comment')->search({}, { rows => 5 });
my $q;
if ($vars->{problem}->comment_count > 0) {
$q = $vars->{problem}->comments;
} else {
$q = $c->model('DB::Comment')->search({}, { rows => 5 });
}
while (my $u = $q->next) {
my $fn = sub {
return FixMyStreet::App::Model::PhotoSet->new({
Expand Down
3 changes: 2 additions & 1 deletion t/app/controller/alert_new.t
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ subtest "Test normal alert signups and that alerts are sent" => sub {

my $email = $emails[0];
is +(my $c = () = $email->as_string =~ /Other User/g), 2, 'Update name given, twice';
unlike $email->as_string, qr/Anonymous User/, 'Update name not given';
unlike $email->as_string, qr/Anonymous User/, 'Update name not given for anonymous update';
like $email->as_string, qr/Posted anonymously/, '"Posted anonymously" text shown for anonymous update';

$report->discard_changes;
ok $report->get_extra_metadata('closure_alert_sent_at'), 'Closure time set';
Expand Down
6 changes: 5 additions & 1 deletion templates/email/default/_email_comment_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
[%~ END %]
[% email_sanitize_html(update) | replace('<p>', '<p style="' _ list_item_p_style _ '">') %]
<p style="[% list_item_date_style %]">
[%~ update.item_name | html IF update.item_name AND NOT update.item_anonymous -%]
[%~ IF update.item_anonymous %]
[%~ loc('Posted anonymously') -%]
[%~ ELSE %]
[%~ update.item_name | html IF update.item_name -%]
[%~ END %]
[% '(' _ cobrand.prettify_dt(update.confirmed) _ ') ' IF cobrand.include_time_in_update_alerts -%]
</p>
</div>
Expand Down