Skip to content

Commit 706ba3f

Browse files
author
David Monllao
committed
Merge branch 'MDL-60924-35' of git://github.com/sarjona/moodle into MOODLE_35_STABLE
2 parents c2c97de + 3fe9524 commit 706ba3f

File tree

5 files changed

+109
-67
lines changed

5 files changed

+109
-67
lines changed

user/amd/build/name_page_filter.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

user/amd/src/name_page_filter.js

Lines changed: 0 additions & 64 deletions
This file was deleted.

user/index.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@
224224

225225
echo '<div class="userlist">';
226226

227+
// Add filters to the baseurl after creating unified_filter to avoid losing them.
228+
foreach ($filtersapplied as $filter) {
229+
$baseurl->param('unified-filters[]', $filter);
230+
}
227231
$participanttable = new \core_user\participants_table($course->id, $groupid, $lastaccess, $roleid, $enrolid, $status,
228232
$searchkeywords, $bulkoperations, $selectall);
229233
$participanttable->define_baseurl($baseurl);
@@ -245,8 +249,6 @@
245249

246250
echo $participanttablehtml;
247251

248-
$PAGE->requires->js_call_amd('core_user/name_page_filter', 'init');
249-
250252
$perpageurl = clone($baseurl);
251253
$perpageurl->remove_params('perpage');
252254
if ($perpage == SHOW_ALL_PAGE_SIZE && $participanttable->totalrows > DEFAULT_PAGE_SIZE) {

user/tests/behat/filter_participants.feature

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,21 @@ Feature: Course participants can be filtered
117117
And I should see "Student 4" in the "participants" "table"
118118
And I should not see "Teacher 1" in the "participants" "table"
119119

120+
@javascript
121+
Scenario: Reorder users without losing filter
122+
Given I log in as "teacher1"
123+
And I am on "Course 1" course homepage
124+
And I navigate to course participants
125+
And I open the autocomplete suggestions list
126+
And I click on "Role: Student" item in the autocomplete list
127+
When I click on "Surname" "link"
128+
Then I should see "Role: Student"
129+
And I should see "Student 1" in the "participants" "table"
130+
And I should see "Student 2" in the "participants" "table"
131+
And I should see "Student 3" in the "participants" "table"
132+
And I should see "Student 4" in the "participants" "table"
133+
And I should not see "Teacher 1" in the "participants" "table"
134+
120135
@javascript
121136
Scenario: Rendering filter options for teachers in a course that don't support groups
122137
Given I log in as "teacher1"
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
@core @core_user
2+
Feature: Course participants can be filtered to display all the users
3+
In order to filter the list of course participants
4+
As a user
5+
I need to visit the course participants page, apply the appropriate filters and show all users per page
6+
7+
Background:
8+
Given the following "courses" exist:
9+
| fullname | shortname | groupmode |
10+
| Course 1 | C1 | 1 |
11+
| Course 2 | C2 | 0 |
12+
And the following "users" exist:
13+
| username | firstname | lastname | email |
14+
| student1 | Student | 1 | student1@example.com |
15+
| student2 | Student | 2 | student2@example.com |
16+
| student3 | Student | 3 | student3@example.com |
17+
| student4 | Student | 4 | student4@example.com |
18+
| student5 | Student | 5 | student5@example.com |
19+
| student6 | Student | 6 | student6@example.com |
20+
| student7 | Student | 7 | student7@example.com |
21+
| student8 | Student | 8 | student8@example.com |
22+
| student9 | Student | 9 | student9@example.com |
23+
| student10 | Student | 10 | student10@example.com |
24+
| student11 | Student | 11 | student11@example.com |
25+
| student12 | Student | 12 | student12@example.com |
26+
| student13 | Student | 13 | student13@example.com |
27+
| student14 | Student | 14 | student14@example.com |
28+
| student15 | Student | 15 | student15@example.com |
29+
| student16 | Student | 16 | student16@example.com |
30+
| student17 | Student | 17 | student17@example.com |
31+
| student18 | Student | 18 | student18@example.com |
32+
| student19 | Student | 19 | student19@example.com |
33+
| student20 | Student | 20 | student20@example.com |
34+
| student21 | Student | 21 | student21@example.com |
35+
| student22 | Student | 22 | student22@example.com |
36+
| student23 | Student | 23 | student23@example.com |
37+
| student24 | Student | 24 | student24@example.com |
38+
| teacher1 | Teacher | 1 | teacher1@example.com |
39+
And the following "course enrolments" exist:
40+
| user | course | role | status | timeend |
41+
| student1 | C1 | student | 0 | |
42+
| student2 | C1 | student | 1 | |
43+
| student3 | C1 | student | 0 | |
44+
| student4 | C1 | student | 0 | |
45+
| student5 | C1 | student | 0 | |
46+
| student6 | C1 | student | 0 | |
47+
| student7 | C1 | student | 0 | |
48+
| student8 | C1 | student | 0 | |
49+
| student9 | C1 | student | 0 | |
50+
| student10 | C1 | student | 0 | |
51+
| student11 | C1 | student | 0 | |
52+
| student12 | C1 | student | 0 | |
53+
| student13 | C1 | student | 0 | |
54+
| student14 | C1 | student | 0 | |
55+
| student15 | C1 | student | 0 | |
56+
| student16 | C1 | student | 0 | |
57+
| student17 | C1 | student | 0 | |
58+
| student18 | C1 | student | 0 | |
59+
| student19 | C1 | student | 0 | |
60+
| student20 | C1 | student | 0 | |
61+
| student21 | C1 | student | 0 | |
62+
| student22 | C1 | student | 0 | |
63+
| student23 | C1 | student | 0 | |
64+
| student24 | C1 | student | 0 | |
65+
| student1 | C2 | student | 0 | |
66+
| student2 | C2 | student | 0 | |
67+
| student3 | C2 | student | 0 | |
68+
| teacher1 | C1 | editingteacher | 0 | |
69+
| teacher1 | C2 | editingteacher | 0 | |
70+
And the following "groups" exist:
71+
| name | course | idnumber |
72+
| Group 1 | C1 | G1 |
73+
| Group 2 | C1 | G2 |
74+
And the following "group members" exist:
75+
| user | group |
76+
| student2 | G1 |
77+
| student2 | G2 |
78+
| student3 | G2 |
79+
80+
@javascript
81+
Scenario: Show all filtered users for a course
82+
Given I log in as "teacher1"
83+
And I am on "Course 1" course homepage
84+
And I navigate to course participants
85+
When I open the autocomplete suggestions list
86+
And I click on "Role: Student" item in the autocomplete list
87+
And I click on "Show all 24" "link"
88+
Then I should see "Role: Student"
89+
And I should see "Number of participants: 24" in the "//div[@class='userlist']" "xpath_element"
90+
And I should see "Show 20 per page"

0 commit comments

Comments
 (0)