Skip to content

Commit

Permalink
MDL-71284 assign: prevent double escaping assignment name.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed May 27, 2021
1 parent 30b8ad5 commit 0fb0743
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/accesslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -6940,7 +6940,7 @@ public function get_context_name($withprefix = true, $short = false, $escape = t
} else {
$name .= format_string(get_course_display_name_for_list($course), true, array('context' => $this));
}
}
}
}
}
return $name;
Expand Down
4 changes: 2 additions & 2 deletions mod/assign/classes/output/grading_app.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function export_for_template(renderer_base $output) {
$export->cmid = $this->assignment->get_course_module()->id;
$export->contextid = $this->assignment->get_context()->id;
$export->groupid = $this->groupid;
$export->name = $this->assignment->get_context()->get_context_name();
$export->name = $this->assignment->get_context()->get_context_name(true, false, false);
$export->courseid = $this->assignment->get_course()->id;
$export->participants = array();
$export->filters = $this->assignment->get_filters();
Expand Down Expand Up @@ -137,7 +137,7 @@ public function export_for_template(renderer_base $output) {

$time = time();
$export->count = count($export->participants);
$export->coursename = $this->assignment->get_course_context()->get_context_name();
$export->coursename = $this->assignment->get_course_context()->get_context_name(true, false, false);
$export->caneditsettings = has_capability('mod/assign:addinstance', $this->assignment->get_context());
$export->duedate = $this->assignment->get_instance()->duedate;
$export->duedatestr = userdate($this->assignment->get_instance()->duedate);
Expand Down
2 changes: 1 addition & 1 deletion mod/assign/templates/grading_navigation.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{{!
Row 1) course name & link.
}}
<a href="{{config.wwwroot}}/course/view.php?id={{courseid}}" title="{{{coursename}}}">{{{coursename}}}</a><br/>
<a href="{{config.wwwroot}}/course/view.php?id={{courseid}}" title="{{coursename}}">{{coursename}}</a><br/>

{{!
Row 2) Assignment name & link, & edit settings.
Expand Down
25 changes: 14 additions & 11 deletions mod/assign/tests/behat/grading_app_filters.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Feature: In an assignment, teachers can change filters in the grading app

Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
| fullname | shortname | category | groupmode |
| Course 1 & | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
Expand All @@ -25,7 +25,7 @@ Feature: In an assignment, teachers can change filters in the grading app
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| name | Test assignment name & |
| idnumber | assign |
| description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
Expand All @@ -36,19 +36,22 @@ Feature: In an assignment, teachers can change filters in the grading app
@javascript
Scenario: Set filters in the grading table and see them in the grading app
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on "Course 1 &" course homepage
And I follow "Test assignment name &"
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I should not see "Course 1 &amp;"
And the "title" attribute of "a[title='Course: Course 1 &']" "css_element" should not contain "&amp;"
And I should not see "Test assignment name &amp;"
And I set the field "allocatedmarker" to "Marker 1"
And I set the field "workflowstate" to "In marking"
And I set the field "Notify students" to "0"
And I press "Save changes"
And I click on "Edit settings" "link"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on "Course 1 &" course homepage
And I follow "Test assignment name &"
And I navigate to "View all submissions" in current page administration
And I set the field "filter" to "Not submitted"
And I set the field "markerfilter" to "Marker 1"
Expand All @@ -61,8 +64,8 @@ Feature: In an assignment, teachers can change filters in the grading app
@javascript
Scenario: Set filters in the grading app and see them in the grading table
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on "Course 1 &" course homepage
And I follow "Test assignment name &"
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "allocatedmarker" to "Marker 1"
Expand All @@ -72,8 +75,8 @@ Feature: In an assignment, teachers can change filters in the grading app
And I click on "Edit settings" "link"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on "Course 1 &" course homepage
And I follow "Test assignment name &"
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I click on "[data-region=user-filters]" "css_element"
Expand Down

0 comments on commit 0fb0743

Please sign in to comment.