diff --git a/src/addons/mod/assign/submission/onlinetext/component/onlinetext.ts b/src/addons/mod/assign/submission/onlinetext/component/onlinetext.ts index d9f32b708..ca9afe172 100644 --- a/src/addons/mod/assign/submission/onlinetext/component/onlinetext.ts +++ b/src/addons/mod/assign/submission/onlinetext/component/onlinetext.ts @@ -111,7 +111,7 @@ export class AddonModAssignSubmissionOnlineTextComponent extends AddonModAssignS * * @param text The new text. */ - onChange(text: string): void { + onChange(text?: string | null): void { // Count words if needed. if (this.wordLimitEnabled) { // Cancel previous wait. diff --git a/src/addons/mod/forum/components/post/post.ts b/src/addons/mod/forum/components/post/post.ts index c2f1d5e80..63f44e1b1 100644 --- a/src/addons/mod/forum/components/post/post.ts +++ b/src/addons/mod/forum/components/post/post.ts @@ -332,8 +332,8 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges * * @param text The new text. */ - onMessageChange(text: string): void { - this.formData.message = text; + onMessageChange(text?: string | null): void { + this.formData.message = text ?? null; } /** diff --git a/src/addons/mod/forum/pages/new-discussion/new-discussion.ts b/src/addons/mod/forum/pages/new-discussion/new-discussion.ts index 6978faa24..3c4921173 100644 --- a/src/addons/mod/forum/pages/new-discussion/new-discussion.ts +++ b/src/addons/mod/forum/pages/new-discussion/new-discussion.ts @@ -511,8 +511,8 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea * * @param text The new text. */ - onMessageChange(text: string): void { - this.newDiscussion.message = text; + onMessageChange(text?: string | null): void { + this.newDiscussion.message = text ?? null; } /** diff --git a/src/addons/mod/glossary/pages/edit/edit.ts b/src/addons/mod/glossary/pages/edit/edit.ts index 882f51daa..d5d9a3ed8 100644 --- a/src/addons/mod/glossary/pages/edit/edit.ts +++ b/src/addons/mod/glossary/pages/edit/edit.ts @@ -173,8 +173,8 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave { * * @param text The new text. */ - onDefinitionChange(text: string): void { - this.data.definition = text; + onDefinitionChange(text?: string | null): void { + this.data.definition = text ?? ''; } /** diff --git a/src/addons/mod/workshop/assessment/accumulative/services/handler.ts b/src/addons/mod/workshop/assessment/accumulative/services/handler.ts index b6ca10e7c..563be19b8 100644 --- a/src/addons/mod/workshop/assessment/accumulative/services/handler.ts +++ b/src/addons/mod/workshop/assessment/accumulative/services/handler.ts @@ -129,9 +129,7 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandlerService implem hasErrors = true; } - if (currentValues[idx].peercomment) { - data['peercomment__idx_' + idx] = currentValues[idx].peercomment; - } + data['peercomment__idx_' + idx] = currentValues[idx].peercomment ?? ''; data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); diff --git a/src/addons/mod/workshop/assessment/numerrors/services/handler.ts b/src/addons/mod/workshop/assessment/numerrors/services/handler.ts index b48e438c6..ce7e5dc39 100644 --- a/src/addons/mod/workshop/assessment/numerrors/services/handler.ts +++ b/src/addons/mod/workshop/assessment/numerrors/services/handler.ts @@ -112,9 +112,7 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandlerService implement hasErrors = true; } - if (currentValues[idx].peercomment) { - data['peercomment__idx_' + idx] = currentValues[idx].peercomment; - } + data['peercomment__idx_' + idx] = currentValues[idx].peercomment ?? ''; data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); diff --git a/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts b/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts index e2ea393c4..90afcbac2 100644 --- a/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts +++ b/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts @@ -403,8 +403,8 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe * * @param text The new text. */ - onFeedbackChange(text: string): void { - this.feedbackText = text; + onFeedbackChange(text?: string | null): void { + this.feedbackText = text ?? ''; } /** diff --git a/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html b/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html index d5c71c7d2..a9ef7ca64 100644 --- a/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html +++ b/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html @@ -23,12 +23,16 @@ phases[workshop!.phase].tasks.length"> - -