MDL-74188 notes: consistent formatting of text content.

Each method of adding notes, either via UI or external service (via
course participant actions), defined the format of the content
different from one another. Neither of those formats were correct.
This commit is contained in:
Paul Holden 2024-06-05 22:33:51 +01:00
parent 6cd55074c7
commit 6c8631bb53
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
2 changed files with 3 additions and 2 deletions

View File

@ -63,7 +63,7 @@ class core_notes_external extends external_api {
'publishstate' => new external_value(PARAM_ALPHA, '\'personal\', \'course\' or \'site\''),
'courseid' => new external_value(PARAM_INT, 'course id of the note (in Moodle a note can only be created into a course, even for site and personal notes)'),
'text' => new external_value(PARAM_RAW, 'the text of the message - text or HTML'),
'format' => new external_format_value('text', VALUE_DEFAULT),
'format' => new external_format_value('text', VALUE_DEFAULT, FORMAT_MOODLE),
'clientnoteid' => new external_value(PARAM_ALPHANUMEXT, 'your own client id for the note. If this id is provided, the fail message id will be returned to you', VALUE_OPTIONAL),
)
)
@ -146,6 +146,7 @@ class core_notes_external extends external_api {
break;
case 'text':
$textformat = FORMAT_PLAIN;
break;
default:
$textformat = util::validate_format($note['format']);
break;

View File

@ -108,7 +108,7 @@ function note_save(&$note) {
$note->lastmodified = time();
$note->usermodified = $USER->id;
if (empty($note->format)) {
$note->format = FORMAT_PLAIN;
$note->format = FORMAT_MOODLE;
}
if (empty($note->publishstate)) {
$note->publishstate = NOTES_STATE_PUBLIC;