Skip to content

Commit

Permalink
fixup! [Bucks] Add email alternative to templates
Browse files Browse the repository at this point in the history
  • Loading branch information
MorayMySoc committed Aug 15, 2022
1 parent 4951f17 commit c6b1cc4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
21 changes: 21 additions & 0 deletions t/app/controller/report_new_update.t
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,27 @@ subtest "test report creation with initial auto-update and alternative email tex
is $mech->get_text_body_from_email($email_for_subscriber) =~ /Thanks for your report. We will investigate within 5 working days./, 1, "Text template sent to subscriber";
is $mech->get_text_body_from_email($email_for_reporter) =~ /This is the email alternative/, 1, "Email template sent to reporter";
is $mech->get_html_body_from_email($email_for_reporter) =~ /<p style="margin: 0 0 16px 0;">\r\nThis is the email alternative.<\/p>/, 1, "Email template text in paragraphs";

my $counciluser = $mech->create_user_ok('[email protected]', name => 'Council User', from_body => $body, is_superuser => 1);
$mech->log_in_ok($counciluser->email);
$mech->get_ok("/admin/report_edit/$report_id");
$mech->content_contains("Template email response: Thanks for your report.
This is the email alternative.", "Extra template email text displayed");
my $update_id = $report->comments->first->id;
$mech->get_ok("/admin/update_edit/$update_id");
$mech->content_contains("<label for='email_detail'>Template email response:</label>
<textarea class='form-control' name='email_detail' id='email_detail' cols=60 rows=10 readonly>Thanks for your report.
This is the email alternative.</textarea></li>", "Extra template email text displayed");
$report->comments->first->delete;
$update_id = $mech->create_comment_for_problem($report, $comment_user, 'User', 'Non-template update', 0, 'confirmed', 'confirmed')->id;
$mech->get_ok("/admin/report_edit/$report_id");
$mech->content_contains("Non-template update", 'Standard update text visible');
$mech->content_lacks("Template email response:", 'Template email munged text not added');
$mech->get_ok("/admin/update_edit/$update_id");
$mech->content_contains("Text:", 'Text box shown for standard update');
$mech->content_lacks("Template email response:", 'Email text box not shown for standard update');
};

done_testing;
Expand Down
7 changes: 6 additions & 1 deletion templates/web/base/admin/list_updates.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ <h2 id="updates">[% loc('Updates') %]</h2>
</td>
</tr>
<tr>
<td colspan=5>[% update.text | html %]</td>
<td colspan=5>[% update.text | html %]
[% IF update.private_email_text %]
<br />---------------------------
<br />Template email response: [% update.private_email_text | html %]
[% END %]
</td>
</tr>
[% END -%]
</table>
Expand Down
5 changes: 5 additions & 0 deletions templates/web/base/admin/update_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<li><label for='detail'>[% loc('Text:') %]</label>
<textarea class="form-control" name='text' id='text' cols=60 rows=10>[% update.text | html %]</textarea></li>

[% IF update.private_email_text %]
<li><label for='email_detail'>[% loc('Template email response:') %]</label>
<textarea class='form-control' name='email_detail' id='email_detail' cols=60 rows=10 readonly>[% update.private_email_text | html %]</textarea></li>
[% END %]

<li><label for="anonymous">[% loc('Anonymous:') %]</label>
<select class="form-control" name="anonymous" id="anonymous">
<option [% 'selected ' IF update.anonymous %]value="1">[% loc('Yes') %]</option>
Expand Down

0 comments on commit c6b1cc4

Please sign in to comment.