From fe76ad9856019af5e30e05b19083e22c25dbc4bd Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Thu, 5 Nov 2026 07:21:15 -0600 Subject: [PATCH] Clean up unused problem URL parameters. The `showOldAnswers` parameter was propagated in site navigation links, problem navigation links, and a hidden field on the problem page, but is never used when rendering a problem. That propagation is removed. The `generateURLs` method copied the `showCorrectAnswers`, `showHints`, `showOldAnswers`, and `showSolutions` parameters into the emailable URL. Only `showCorrectAnswers` affects rendering, and only via the instructor-only "Show Correct Answers" button. On the feedback page the values were the display permissions, so `showCorrectAnswers=1` was added after the answer date and the instructor got the correct-answers-only view instead of what the student saw. None of these are added anymore. Co-Authored-By: Claude Opus 5.5 --- lib/WeBWorK/ContentGenerator.pm | 5 +---- lib/WeBWorK/ContentGenerator/Problem.pm | 4 ---- lib/WeBWorK/Utils.pm | 3 --- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator.pm b/lib/WeBWorK/ContentGenerator.pm index 8a18e020c6..c372575b2f 100644 --- a/lib/WeBWorK/ContentGenerator.pm +++ b/lib/WeBWorK/ContentGenerator.pm @@ -455,9 +455,6 @@ sub links ($c) { } } - # System link parameters that are common to all links (except the Courses link). - my %systemlink_params = ($c->param('showOldAnswers') ? (showOldAnswers => $c->param('showOldAnswers')) : ()); - my $current_url = $c->url_for; # Subroutine for generating links. @@ -474,7 +471,7 @@ sub links ($c) { # Mojolicious has already encoded html entities at this point. return $c->link_to( ($options{text} // route_title($c, $route_name, 1)) => $c->systemLink( - $new_url, params => { %systemlink_params, %{ $options{systemlink_params} // {} } } + $new_url, params => $options{systemlink_params} // {} ), class => 'nav-link' . ($active ? ' active' : ''), $options{target} ? (target => $options{target}) : (), diff --git a/lib/WeBWorK/ContentGenerator/Problem.pm b/lib/WeBWorK/ContentGenerator/Problem.pm index 9e733acbdb..a8221649d3 100644 --- a/lib/WeBWorK/ContentGenerator/Problem.pm +++ b/lib/WeBWorK/ContentGenerator/Problem.pm @@ -823,7 +823,6 @@ sub nav ($c, $args) { } my %tail; - $tail{showOldAnswers} = 1 if $c->{will}{showOldAnswers}; $tail{studentNavFilter} = $c->param('studentNavFilter') if $c->param('studentNavFilter'); return $c->tag( @@ -1223,9 +1222,6 @@ sub output_score_summary ($c) { sub output_misc ($c) { my $output = $c->c; - # Save state for viewOptions - push(@$output, $c->hidden_field(showOldAnswers => $c->{will}{showOldAnswers})); - # Only allow file editing for users that have the permission to modify problem sets. if ($c->authz->hasPermissions($c->authen->{user_id}, 'modify_problem_sets')) { push(@$output, $c->hidden_field(editMode => $c->{editMode})) diff --git a/lib/WeBWorK/Utils.pm b/lib/WeBWorK/Utils.pm index 592653b4d7..ea8e583483 100644 --- a/lib/WeBWorK/Utils.pm +++ b/lib/WeBWorK/Utils.pm @@ -392,9 +392,6 @@ sub generateURLs ($c, %params) { 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}); - for my $name ('showCorrectAnswers', 'showHints', 'showOldAnswers', 'showSolutions') { - $args{$name} = [ $c->param($name) ] if defined $c->param($name) && $c->param($name) ne ''; - } } else { $routePath = $c->url_for('problem_list', setID => $params{set_id}); }