Skip to content

Commit

Permalink
MDL-74188 notes: consistent formatting of text content.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
paulholden committed Aug 16, 2024
1 parent 6cd5507 commit 6c8631b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion notes/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function create_notes_parameters() {
'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),
)
)
Expand Down Expand Up @@ -146,6 +146,7 @@ public static function create_notes($notes = array()) {
break;
case 'text':
$textformat = FORMAT_PLAIN;
break;
default:
$textformat = util::validate_format($note['format']);
break;
Expand Down
2 changes: 1 addition & 1 deletion notes/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6c8631b

Please sign in to comment.