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-08-16 10:19:54 +01:00
parent 6cd55074c7
commit 6c8631bb53
2 changed files with 3 additions and 2 deletions
+2 -1
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;
+1 -1
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;