Skip to content
Open
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
5 changes: 4 additions & 1 deletion templates/ContentGenerator/Feedback/feedback_email.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
% } elsif ($set) {
Message from <%= $user->full_name %> (<%= $user->user_id %>) via WeBWorK at
<%= $ce->{institutionName} %>
(sent from <%= link_to format_set_name_display($set->set_id) => $emailableURL %>)
(sent from <%= link_to format_set_name_display($set->set_id) => $emailableURL %>).
% } else {
Message from <%= $user->full_name %> (<%= $user->user_id %>) via WeBWorK at
<%= $ce->{institutionName} %> (sent from <%= link_to 'this page' => $emailableURL %>).
% }
</p>
% if ($c->stash->{numRecipients} > 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
% if ($c->stash->{numRecipients} > 1) {
% if ($numRecipients > 1) {

Stash values are converted into variables when templates are compiled. The only time you need to be careful and actually get them from the stash is if the stash value might not be defined. In that case the variable won't exist and the template will fail to compile. In this case this stash value will always be defined.

<p><%= maketext('Message delivered to multiple recipients. Consider using reply-all.') =%></p>
% }
% if ($feedback) {
<div style="border: 1px solid lightgray; padding: 1rem; margin-bottom: 1rem; border-radius: 0.375rem">
% for (split /\n\r?/, $feedback) {
Expand Down
5 changes: 5 additions & 0 deletions templates/ContentGenerator/Feedback/feedback_email.txt.ep
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Feedback sent from:
% }
<%== $emailableURL %>

% if ($c->stash->{numRecipients} > 1) {

<%= maketext('Message delivered to multiple recipients. Consider using reply-all.') =%>
Comment on lines 14 to +17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
% if ($c->stash->{numRecipients} > 1) {
<%= maketext('Message delivered to multiple recipients. Consider using reply-all.') =%>
% if ($numRecipients > 1) {
<%= maketext('Message delivered to multiple recipients. Consider using reply-all.') %>

The reasoning for the switch from $c->stash->{numRecients} to $numRecipients is the same as the other comment.

The rest is about spacing. The empty line before the conditional together with the empty line after it result in two empty lines in the text email. The =%> ending that you had at the end of the template substitution strips whitespace after the substitution which result in the empty line after it being removed. The result with your code is:

Feedback sent from setID:
page url here


Message delivered to multiple recipients. Consider using reply-all.
Username (userId) wrote:

With my changes it becomes

Feedback sent from setID:
page url here

Message delivered to multiple recipients. Consider using reply-all.

Username (userId) wrote:

Also, in the case that there is only one recipient so that this new message is not shown, then the empty line before and the emtpy line after both are in the output (the =%> substition doesn't happen in this case), and so even in that case there are two empty lines. The above changes cover this case also.

% }

% if ($feedback) {
<%== $user->full_name %> (<%== $user->user_id %>) wrote:

Expand Down