diff --git a/src/addons/mod/assign/assign.module.ts b/src/addons/mod/assign/assign.module.ts index fbf319570..fdbf18fd4 100644 --- a/src/addons/mod/assign/assign.module.ts +++ b/src/addons/mod/assign/assign.module.ts @@ -22,6 +22,7 @@ import { CorePushNotificationsDelegate } from '@features/pushnotifications/servi import { CoreCronDelegate } from '@services/cron'; import { CORE_SITE_SCHEMAS } from '@services/sites'; import { AddonModAssignComponentsModule } from './components/components.module'; +import { AddonModAssignFeedbackModule } from './feedback/feedback.module'; import { OFFLINE_SITE_SCHEMA } from './services/database/assign'; import { AddonModAssignIndexLinkHandler } from './services/handlers/index-link'; import { AddonModAssignListLinkHandler } from './services/handlers/list-link'; @@ -43,6 +44,7 @@ const routes: Routes = [ CoreMainMenuTabRoutingModule.forChild(routes), AddonModAssignComponentsModule, AddonModAssignSubmissionModule, + AddonModAssignFeedbackModule, ], providers: [ { diff --git a/src/addons/mod/assign/components/feedback-plugin/feedback-plugin.ts b/src/addons/mod/assign/components/feedback-plugin/feedback-plugin.ts index b84b54808..96f5be1ab 100644 --- a/src/addons/mod/assign/components/feedback-plugin/feedback-plugin.ts +++ b/src/addons/mod/assign/components/feedback-plugin/feedback-plugin.ts @@ -17,7 +17,7 @@ import { CoreError } from '@classes/errors/error'; import { CoreDynamicComponent } from '@components/dynamic-component/dynamic-component'; import { CoreWSExternalFile } from '@services/ws'; import { ModalController } from '@singletons'; -import { AddonModAssignFeedbackCommentsPluginData } from '../../feedback/comments/services/handler'; +import { AddonModAssignFeedbackCommentsTextData } from '../../feedback/comments/services/handler'; import { AddonModAssignAssign, AddonModAssignSubmission, @@ -104,7 +104,7 @@ export class AddonModAssignFeedbackPluginComponent implements OnInit { * * @return Promise resolved with the input data, rejected if cancelled. */ - editFeedback(): Promise { + editFeedback(): Promise { if (!this.canEdit) { throw new CoreError('Cannot edit feedback'); } @@ -115,7 +115,7 @@ export class AddonModAssignFeedbackPluginComponent implements OnInit { } protected async showEditFeedbackModal( - resolve: (value: AddonModAssignFeedbackCommentsPluginData | PromiseLike) => void, + resolve: (value: AddonModAssignFeedbackCommentsTextData | PromiseLike) => void, reject: () => void, ): Promise < void> { // Create the navigation modal. diff --git a/src/addons/mod/assign/feedback/comments/comments.module.ts b/src/addons/mod/assign/feedback/comments/comments.module.ts index f0f79618b..4581d686e 100644 --- a/src/addons/mod/assign/feedback/comments/comments.module.ts +++ b/src/addons/mod/assign/feedback/comments/comments.module.ts @@ -18,7 +18,6 @@ import { AddonModAssignFeedbackCommentsComponent } from './component/comments'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreEditorComponentsModule } from '@features/editor/components/components.module'; import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate'; -import { AddonModAssignSubmissionFileHandler } from '../../submission/file/services/handler'; @NgModule({ declarations: [ @@ -35,7 +34,7 @@ import { AddonModAssignSubmissionFileHandler } from '../../submission/file/servi multi: true, deps: [], useFactory: () => () => { - AddonModAssignFeedbackDelegate.instance.registerHandler(AddonModAssignSubmissionFileHandler.instance); + AddonModAssignFeedbackDelegate.instance.registerHandler(AddonModAssignFeedbackCommentsHandler.instance); }, }, ], diff --git a/src/addons/mod/assign/feedback/comments/services/handler.ts b/src/addons/mod/assign/feedback/comments/services/handler.ts index 58c98ff34..22852c3b5 100644 --- a/src/addons/mod/assign/feedback/comments/services/handler.ts +++ b/src/addons/mod/assign/feedback/comments/services/handler.ts @@ -49,14 +49,11 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss * @param inputData Data entered in the feedback edit form. * @return Text to submit. */ - getTextFromInputData(plugin: AddonModAssignPlugin, inputData: AddonModAssignFeedbackCommentsPluginData): string { + getTextFromInputData(plugin: AddonModAssignPlugin, inputData: AddonModAssignFeedbackCommentsTextData): string { const files = plugin.fileareas && plugin.fileareas[0] ? plugin.fileareas[0].files : []; - let text = ''; // The input data can have a string or an object with text and format. Get the text. - if (inputData.assignfeedbackcomments_editor && inputData.assignfeedbackcomments_editor.text) { - text = inputData.assignfeedbackcomments_editor.text; - } + const text = inputData.assignfeedbackcomments_editor || ''; return CoreTextUtils.instance.restorePluginfileUrls(text, files || []); } @@ -147,7 +144,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss assign: AddonModAssignAssign, submission: AddonModAssignSubmission, plugin: AddonModAssignPlugin, - inputData: AddonModAssignFeedbackCommentsPluginData, + inputData: AddonModAssignFeedbackCommentsTextData, userId: number, ): Promise { // Get it from plugin or offline. @@ -254,6 +251,11 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss } export const AddonModAssignFeedbackCommentsHandler = makeSingleton(AddonModAssignFeedbackCommentsHandlerService); +export type AddonModAssignFeedbackCommentsTextData = { + // The text for this submission. + assignfeedbackcomments_editor: string; // eslint-disable-line @typescript-eslint/naming-convention +}; + export type AddonModAssignFeedbackCommentsDraftData = { text: string; // The text for this feedback. format: number; // The format for this feedback.