Skip to content

Commit

Permalink
Merge pull request #2649 from Alex-Jordan/email-format
Browse files Browse the repository at this point in the history
change introduction to feedback emails
  • Loading branch information
drgrice1 authored Feb 11, 2025
2 parents 6f094c0 + b1f4114 commit 39e62bf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
3 changes: 2 additions & 1 deletion lib/WeBWorK/ContentGenerator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,8 @@ sub systemLink ($c, $urlpath, %options) {
my $url = $options{use_abs_url} ? $urlpath->to_abs : $urlpath;

for my $name (keys %params) {
$params{$name} = [ $c->param($name) ] if (!defined $params{$name} && defined $c->param($name));
$params{$name} = [ $c->param($name) ]
if (!defined $params{$name} && defined $c->param($name) && $c->param($name) ne '');
}

return %params ? $url->query(%params) : $url;
Expand Down
12 changes: 4 additions & 8 deletions lib/WeBWorK/ContentGenerator/Feedback.pm
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,11 @@ sub initialize ($c) {

my $systemURL = $c->url_for('root')->to_abs;

my $msg = qq/This message was automatically generated by the WeBWorK
system at $systemURL, in response to a request from $remote_host:$remote_port.
Click this link to see the page from which the user sent feedback:
$emailableURL
/;
my $msg = sprintf("Message from %s (%s) via WeBWorK at\n%s\n\n", $user->full_name, $user->user_id, $systemURL);
$msg .= "To visit the page from which the user sent feedback, go to:\n$emailableURL\n\n";

if ($feedback) {
$msg .= qq/***** The feedback message: *****\n\n\n$feedback\n\n\n/;
$msg .= sprintf("%s (%s) wrote:\n\n\n%s\n\n\n", $user->full_name, $user->user_id, $feedback);
}
if ($problem and $verbosity >= 1) {
$msg .=
Expand All @@ -172,6 +167,7 @@ $emailableURL
if ($user && $verbosity >= 1) {
$msg .= "***** Data about the user: *****\n\n";
$msg .= $c->format_user($user) . "\n";
$msg .= "$remote_host:$remote_port\n";
}

if ($problem && $verbosity >= 1) {
Expand Down
17 changes: 8 additions & 9 deletions lib/WeBWorK/Utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -358,24 +358,23 @@ sub generateURLs ($c, %params) {

if ($userName) {
my $routePath;
my @args;
my %args;
if (defined $params{set_id} && $params{set_id} ne '') {
if ($params{problem_id}) {
$routePath = $c->url_for('problem_detail', setID => $params{set_id}, problemID => $params{problem_id});
@args = qw/displayMode showOldAnswers showCorrectAnswers showHints showSolutions/;
for my $name ('displayMode', 'showCorrectAnswers', 'showHints', 'showOldAnswers', 'showSolutions') {
$args{$name} = [ $c->param($name) ] if defined $c->param($name) && $c->param($name) ne '';
}
$args{showProblemGrader} = 1;
} else {
$routePath = $c->url_for('problem_list', setID => $params{set_id});
}
} else {
$routePath = $c->url_for('set_list');
}
$emailableURL = $c->systemLink(
$routePath,
authen => 0,
params => [ 'effectiveUser', @args ],
use_abs_url => 1,
);
$returnURL = $c->systemLink($routePath, params => [@args]);
$args{effectiveUser} = [ $c->param('effectiveUser') ] if defined $c->param('effectiveUser');
$emailableURL = $routePath->to_abs->query(map { $_ => $args{$_} } sort keys %args);
$returnURL = $c->systemLink($routePath);
} else {
$emailableURL = '(not available)';
$returnURL = '';
Expand Down

0 comments on commit 39e62bf

Please sign in to comment.