diff --git a/src/addons/mod/assign/components/components.module.ts b/src/addons/mod/assign/components/components.module.ts index 233a7c3aa..d215e9d79 100644 --- a/src/addons/mod/assign/components/components.module.ts +++ b/src/addons/mod/assign/components/components.module.ts @@ -13,10 +13,6 @@ // limitations under the License. import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { IonicModule } from '@ionic/angular'; -import { TranslateModule } from '@ngx-translate/core'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreCourseComponentsModule } from '@features/course/components/components.module'; @@ -35,10 +31,6 @@ import { AddonModAssignEditFeedbackModalComponent } from './edit-feedback-modal/ AddonModAssignEditFeedbackModalComponent, ], imports: [ - CommonModule, - IonicModule, - TranslateModule.forChild(), - FormsModule, CoreSharedModule, CoreCourseComponentsModule, ], 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 96f5be1ab..650074442 100644 --- a/src/addons/mod/assign/components/feedback-plugin/feedback-plugin.ts +++ b/src/addons/mod/assign/components/feedback-plugin/feedback-plugin.ts @@ -104,20 +104,11 @@ export class AddonModAssignFeedbackPluginComponent implements OnInit { * * @return Promise resolved with the input data, rejected if cancelled. */ - editFeedback(): Promise { + async editFeedback(): Promise { if (!this.canEdit) { throw new CoreError('Cannot edit feedback'); } - return new Promise((resolve, reject): void => { - this.showEditFeedbackModal(resolve, reject); - }); - } - - protected async showEditFeedbackModal( - resolve: (value: AddonModAssignFeedbackCommentsTextData | PromiseLike) => void, - reject: () => void, - ): Promise < void> { // Create the navigation modal. const modal = await ModalController.instance.create({ component: AddonModAssignEditFeedbackModalComponent, @@ -134,9 +125,9 @@ export class AddonModAssignFeedbackPluginComponent implements OnInit { const result = await modal.onDidDismiss(); if (typeof result.data == 'undefined') { - reject(); + throw null; // User cancelled. } else { - resolve(result.data); + return result.data; } } diff --git a/src/addons/mod/assign/components/submission/addon-mod-assign-submission.html b/src/addons/mod/assign/components/submission/addon-mod-assign-submission.html index 2185a1124..93a6b796f 100644 --- a/src/addons/mod/assign/components/submission/addon-mod-assign-submission.html +++ b/src/addons/mod/assign/components/submission/addon-mod-assign-submission.html @@ -1,7 +1,8 @@ - +

{{ user!.fullname }}

diff --git a/src/addons/mod/assign/feedback/comments/comments.module.ts b/src/addons/mod/assign/feedback/comments/comments.module.ts index 4581d686e..3cf1f28a5 100644 --- a/src/addons/mod/assign/feedback/comments/comments.module.ts +++ b/src/addons/mod/assign/feedback/comments/comments.module.ts @@ -28,7 +28,6 @@ import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate CoreEditorComponentsModule, ], providers: [ - AddonModAssignFeedbackCommentsHandler, { provide: APP_INITIALIZER, multi: true, diff --git a/src/addons/mod/assign/feedback/editpdf/editpdf.module.ts b/src/addons/mod/assign/feedback/editpdf/editpdf.module.ts index 1db4ecd21..c91596cb2 100644 --- a/src/addons/mod/assign/feedback/editpdf/editpdf.module.ts +++ b/src/addons/mod/assign/feedback/editpdf/editpdf.module.ts @@ -26,7 +26,6 @@ import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate CoreSharedModule, ], providers: [ - AddonModAssignFeedbackEditPdfHandler, { provide: APP_INITIALIZER, multi: true, diff --git a/src/addons/mod/assign/feedback/file/file.module.ts b/src/addons/mod/assign/feedback/file/file.module.ts index c4e59e063..45bfddd28 100644 --- a/src/addons/mod/assign/feedback/file/file.module.ts +++ b/src/addons/mod/assign/feedback/file/file.module.ts @@ -26,7 +26,6 @@ import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate CoreSharedModule, ], providers: [ - AddonModAssignFeedbackFileHandler, { provide: APP_INITIALIZER, multi: true, diff --git a/src/addons/mod/assign/pages/edit/edit.ts b/src/addons/mod/assign/pages/edit/edit.ts index 49198b4c4..0b6b1075d 100644 --- a/src/addons/mod/assign/pages/edit/edit.ts +++ b/src/addons/mod/assign/pages/edit/edit.ts @@ -15,7 +15,6 @@ import { Component, OnInit, OnDestroy, ViewChild, ElementRef } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { CoreError } from '@classes/errors/error'; -import { CoreIonLoadingElement } from '@classes/ion-loading'; import { CoreFileUploaderHelper } from '@features/fileuploader/services/fileuploader-helper'; import { CoreNavigator } from '@services/navigator'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; @@ -208,26 +207,15 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy { * * @return Promise resolved with boolean: whether data has changed. */ - protected hasDataChanged(): Promise { + protected async hasDataChanged(): Promise { // Usually the hasSubmissionDataChanged call will be resolved inmediately, causing the modal to be shown just an instant. // We'll wait a bit before showing it to prevent this "blink". - let modal: CoreIonLoadingElement; - let showModal = true; - - setTimeout(async () => { - if (showModal) { - modal = await CoreDomUtils.instance.showModalLoading(); - } - }, 100); + const modal = await CoreDomUtils.instance.showModalLoading(); const data = this.getInputData(); return AddonModAssignHelper.instance.hasSubmissionDataChanged(this.assign!, this.userSubmission, data).finally(() => { - if (modal) { - modal.dismiss(); - } else { - showModal = false; - } + modal.dismiss(); }); } diff --git a/src/addons/mod/assign/services/assign-helper.ts b/src/addons/mod/assign/services/assign-helper.ts index 0e797419d..178408d8b 100644 --- a/src/addons/mod/assign/services/assign-helper.ts +++ b/src/addons/mod/assign/services/assign-helper.ts @@ -245,7 +245,6 @@ export class AddonModAssignHelperProvider { // If no participants returned and all groups specified, get participants by groups. const groupsInfo = await CoreGroups.instance.getActivityGroupInfo(assign.cmid, false, undefined, modOptions.siteId); - []; const participantsIndexed: {[id: number]: AddonModAssignParticipant} = {}; @@ -582,7 +581,7 @@ export class AddonModAssignHelperProvider { siteId?: string, ): Promise { - const pluginData = {}; + const pluginData: Record = {}; const promises = feedback.plugins ? feedback.plugins.map((plugin) => AddonModAssignFeedbackDelegate.instance.preparePluginFeedbackData(assignId, userId, plugin, pluginData, siteId)) diff --git a/src/addons/mod/assign/services/assign.ts b/src/addons/mod/assign/services/assign.ts index b1d63013b..3a11c8b94 100644 --- a/src/addons/mod/assign/services/assign.ts +++ b/src/addons/mod/assign/services/assign.ts @@ -31,6 +31,7 @@ import { AddonModAssignOffline } from './assign-offline'; import { AddonModAssignSubmissionDelegate } from './submission-delegate'; import { CoreComments } from '@features/comments/services/comments'; import { AddonModAssignSubmissionFormatted } from './assign-helper'; +import { CoreWSError } from '@classes/errors/wserror'; const ROOT_CACHE_KEY = 'mmaModAssign:'; @@ -1119,7 +1120,7 @@ export class AddonModAssignProvider { if (warnings.length) { // The WebService returned warnings, reject. - throw warnings[0]; + throw new CoreWSError(warnings[0]); } } @@ -1202,7 +1203,7 @@ export class AddonModAssignProvider { if (warnings.length) { // The WebService returned warnings, reject. - throw warnings[0]; + throw new CoreWSError(warnings[0]); } } @@ -1371,7 +1372,7 @@ export class AddonModAssignProvider { if (warnings.length) { // The WebService returned warnings, reject. - throw warnings[0]; + throw new CoreWSError(warnings[0]); } } diff --git a/src/addons/mod/assign/services/database/assign.ts b/src/addons/mod/assign/services/database/assign.ts index 949a1e580..7a4a608f1 100644 --- a/src/addons/mod/assign/services/database/assign.ts +++ b/src/addons/mod/assign/services/database/assign.ts @@ -16,7 +16,8 @@ import { CoreSiteSchema } from '@services/sites'; /** * Database variables for AddonModAssignOfflineProvider. - */export const SUBMISSIONS_TABLE = 'addon_mod_assign_submissions'; + */ +export const SUBMISSIONS_TABLE = 'addon_mod_assign_submissions'; export const SUBMISSIONS_GRADES_TABLE = 'addon_mod_assign_submissions_grading'; export const OFFLINE_SITE_SCHEMA: CoreSiteSchema = { name: 'AddonModAssignOfflineProvider', diff --git a/src/addons/mod/assign/submission/comments/comments.module.ts b/src/addons/mod/assign/submission/comments/comments.module.ts index bb05dbd18..91faee3aa 100644 --- a/src/addons/mod/assign/submission/comments/comments.module.ts +++ b/src/addons/mod/assign/submission/comments/comments.module.ts @@ -28,7 +28,6 @@ import { CoreCommentsComponentsModule } from '@features/comments/components/comp CoreCommentsComponentsModule, ], providers: [ - AddonModAssignSubmissionCommentsHandler, { provide: APP_INITIALIZER, multi: true, diff --git a/src/addons/mod/assign/submission/file/file.module.ts b/src/addons/mod/assign/submission/file/file.module.ts index cf97e85f7..be02d065a 100644 --- a/src/addons/mod/assign/submission/file/file.module.ts +++ b/src/addons/mod/assign/submission/file/file.module.ts @@ -26,7 +26,6 @@ import { AddonModAssignSubmissionDelegate } from '../../services/submission-dele CoreSharedModule, ], providers: [ - AddonModAssignSubmissionFileHandler, { provide: APP_INITIALIZER, multi: true, diff --git a/src/addons/mod/assign/submission/onlinetext/onlinetext.module.ts b/src/addons/mod/assign/submission/onlinetext/onlinetext.module.ts index cbcaaa5ba..77a69e767 100644 --- a/src/addons/mod/assign/submission/onlinetext/onlinetext.module.ts +++ b/src/addons/mod/assign/submission/onlinetext/onlinetext.module.ts @@ -28,7 +28,6 @@ import { AddonModAssignSubmissionDelegate } from '../../services/submission-dele CoreEditorComponentsModule, ], providers: [ - AddonModAssignSubmissionOnlineTextHandler, { provide: APP_INITIALIZER, multi: true, diff --git a/src/core/classes/ion-loading.ts b/src/core/classes/ion-loading.ts index 450e0aced..5f4dc9e2a 100644 --- a/src/core/classes/ion-loading.ts +++ b/src/core/classes/ion-loading.ts @@ -42,7 +42,7 @@ export class CoreIonLoadingElement { * Present the loading. */ async present(): Promise { - // Wait a bit before presenting the modal, to prevent it being displayed if dissmiss is called fast. + // Wait a bit before presenting the modal, to prevent it being displayed if dismiss is called fast. await CoreUtils.instance.wait(40); if (!this.isDismissed) {