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

This commit is contained in:
Jun Pataleta 2024-10-17 12:17:38 +08:00
commit 540fda4055
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
3 changed files with 6 additions and 10 deletions

View File

@ -109,7 +109,7 @@ Feature: A course welcome message will be sent to the user when they are enrolle
And I should see "Your email address: first@example.com"
And I should see "Your first name: First"
And I should see "Your last name: User"
And I should see "Your course role: student"
And I should see "Your course role: Student"
# Login as second user and check the notification.
When I am on the "C1" "course" page logged in as user2
Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
@ -120,4 +120,4 @@ Feature: A course welcome message will be sent to the user when they are enrolle
And I should see "Your email address: second@example.com"
And I should see "Your first name: Second"
And I should see "Your last name: User"
And I should see "Your course role: student"
And I should see "Your course role: Student"

View File

@ -99,7 +99,7 @@ Feature: A course welcome message will be sent to the user when they auto-enrol
And I should see "Your email address: first@example.com"
And I should see "Your first name: First"
And I should see "Your last name: User"
And I should see "Your course role: student"
And I should see "Your course role: Student"
# Login as second user and check the notification.
And I log in as "user2"
And I am on "Course 1" course homepage
@ -112,4 +112,4 @@ Feature: A course welcome message will be sent to the user when they auto-enrol
And I should see "Your email address: second@example.com"
And I should see "Your first name: Second"
And I should see "Your last name: User"
And I should see "Your course role: student"
And I should see "Your course role: Student"

View File

@ -3655,11 +3655,7 @@ abstract class enrol_plugin {
$context = context_course::instance($instance->courseid);
$user = core_user::get_user($userid);
$course = get_course($instance->courseid);
$courserole = $DB->get_field(
table: 'role',
return: 'shortname',
conditions: ['id' => $instance->roleid],
);
$courserole = $DB->get_record('role', ['id' => $instance->roleid]);
$a = new stdClass();
$a->coursename = format_string($course->fullname, true, ['context' => $context, 'escape' => false]);
@ -3689,7 +3685,7 @@ abstract class enrol_plugin {
$user->email,
$user->firstname,
$user->lastname,
$courserole,
role_get_name($courserole, $context),
];
$message = str_replace($placeholders, $values, $message);
if (strpos($message, '<') === false) {