mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
Merge branch 'MDL-75802' of https://github.com/paulholden/moodle
This commit is contained in:
commit
3667a702db
@ -230,6 +230,12 @@ if ($formaction == 'bulkchange.php') {
|
||||
};
|
||||
$filteredusers = array_filter($users, $matchesplugin);
|
||||
|
||||
// If the bulk operation is deleting enrolments, we exclude in any case the current user as it was probably a mistake.
|
||||
if ($operationname === 'deleteselectedusers' && (!in_array($USER->id, $removed))) {
|
||||
\core\notification::warning(get_string('userremovedfromselectiona', 'enrol', fullname($USER)));
|
||||
unset($filteredusers[$USER->id]);
|
||||
}
|
||||
|
||||
if (empty($filteredusers)) {
|
||||
redirect($returnurl, get_string('noselectedusers', 'bulkusers'));
|
||||
}
|
||||
|
@ -48,6 +48,26 @@ Feature: Bulk enrolments
|
||||
And I should not see "Teacher 1"
|
||||
And I should see "3 unenrolled users"
|
||||
|
||||
@javascript
|
||||
Scenario: Bulk delete enrolments when user is themselves enrolled
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
And I click on "Select all" "checkbox"
|
||||
And I set the field "With selected users..." to "Delete selected user enrolments"
|
||||
Then I should see "User \"Teacher 1\" was removed from the selection."
|
||||
And the following should exist in the "generaltable" table:
|
||||
| Name | Status |
|
||||
| Student 1 | Active |
|
||||
| Student 2 | Active |
|
||||
And I should not see "Teacher 1" in the "generaltable" "table"
|
||||
And I press "Unenrol users"
|
||||
And I should see "2 unenrolled users"
|
||||
And I should see "User \"Teacher 1\" was removed from the selection."
|
||||
And I should see "Teacher 1" in the "participants" "table"
|
||||
And I should not see "Student 1" in the "participants" "table"
|
||||
And I should not see "Student 2" in the "participants" "table"
|
||||
|
||||
@javascript
|
||||
Scenario: Bulk edit enrolment for deleted user
|
||||
When I log in as "admin"
|
||||
|
Loading…
x
Reference in New Issue
Block a user