Merge branch 'MDL-82663-404' of https://github.com/paulholden/moodle into MOODLE_404_STABLE

This commit is contained in:
Ilya Tregubov 2024-09-20 10:17:24 +08:00
commit ff4f52ddcf
2 changed files with 3 additions and 2 deletions

View File

@ -231,7 +231,7 @@ 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))) {
if ($operationname === 'deleteselectedusers' && array_key_exists($USER->id, $filteredusers)) {
\core\notification::warning(get_string('userremovedfromselectiona', 'enrol', fullname($USER)));
unset($filteredusers[$USER->id]);
}

View File

@ -53,8 +53,10 @@ Feature: Bulk enrolments
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to course participants
# Select all three users (the teacher themselves and both students).
And I click on "Select all" "checkbox"
And I set the field "With selected users..." to "Delete selected user enrolments"
# Teacher is informed that they've been removed from current selection.
Then I should see "User \"Teacher 1\" was removed from the selection."
And the following should exist in the "generaltable" table:
| Name | Status |
@ -63,7 +65,6 @@ Feature: Bulk enrolments
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"