From d3718c057304d7c9a28cdcb769bbfc65d8ca3aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 23 Jan 2020 10:29:52 +0100 Subject: [PATCH] MOBILE-3314 assign: Check grade access before prefetch --- src/addon/mod/assign/providers/prefetch-handler.ts | 6 +++++- src/addon/mod/wiki/providers/prefetch-handler.ts | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/addon/mod/assign/providers/prefetch-handler.ts b/src/addon/mod/assign/providers/prefetch-handler.ts index 56d0b4ba0..ca7865ea0 100644 --- a/src/addon/mod/assign/providers/prefetch-handler.ts +++ b/src/addon/mod/assign/providers/prefetch-handler.ts @@ -443,7 +443,11 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan // Prefetch grade items. if (userId) { - promises.push(this.gradesHelper.getGradeModuleItems(courseId, moduleId, userId, undefined, siteId, true)); + promises.push(this.courseProvider.getModuleBasicGradeInfo(moduleId, siteId).then((gradeInfo) => { + if (gradeInfo) { + promises.push(this.gradesHelper.getGradeModuleItems(courseId, moduleId, userId, undefined, siteId, true)); + } + })); } // Prefetch feedback. diff --git a/src/addon/mod/wiki/providers/prefetch-handler.ts b/src/addon/mod/wiki/providers/prefetch-handler.ts index cfec49818..7870b158d 100644 --- a/src/addon/mod/wiki/providers/prefetch-handler.ts +++ b/src/addon/mod/wiki/providers/prefetch-handler.ts @@ -24,7 +24,6 @@ import { CoreGroupsProvider } from '@providers/groups'; import { CoreTextUtilsProvider } from '@providers/utils/text'; import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/activity-prefetch-handler'; import { CoreCourseHelperProvider } from '@core/course/providers/helper'; -import { CoreGradesHelperProvider } from '@core/grades/providers/helper'; import { CoreUserProvider } from '@core/user/providers/user'; import { AddonModWikiProvider } from './wiki'; import { AddonModWikiSyncProvider } from './wiki-sync'; @@ -55,7 +54,6 @@ export class AddonModWikiPrefetchHandler extends CoreCourseActivityPrefetchHandl protected textUtils: CoreTextUtilsProvider, protected courseHelper: CoreCourseHelperProvider, protected groupsProvider: CoreGroupsProvider, - protected gradesHelper: CoreGradesHelperProvider, protected syncProvider: AddonModWikiSyncProvider) { super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper,