Merge branch 'MDL-79557-master' of https://github.com/jleyva/moodle

This commit is contained in:
Jun Pataleta 2023-10-03 12:18:13 +08:00
commit b896c303f3
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
2 changed files with 4 additions and 1 deletions

View File

@ -2141,6 +2141,8 @@ class core_message_external extends external_api {
$message->usertofullname = $usertofullname;
}
// Clean subject of html.
$message->subject = clean_param($message->subject, PARAM_TEXT);
$message->text = message_format_message_text($message);
$messages[$mid] = (array) $message;
}

View File

@ -1438,13 +1438,14 @@ class externallib_test extends externallib_advanced_testcase {
$eventdata->smallmessage = $eventdata->subject;
message_send($eventdata);
// This event contains HTML in the subject field that will be removed by the WS (otherwise it will generate an exception).
$eventdata = new \core\message\message();
$eventdata->courseid = $course->id;
$eventdata->name = 'submission';
$eventdata->component = 'mod_feedback';
$eventdata->userfrom = $user1;
$eventdata->userto = $user2;
$eventdata->subject = 'Feedback submitted';
$eventdata->subject = 'Feedback submitted <span>with html</span>';
$eventdata->fullmessage = 'Feedback submitted from an user';
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '<strong>Feedback submitted</strong>';