diff --git a/src/addon/mod/assign/providers/prefetch-handler.ts b/src/addon/mod/assign/providers/prefetch-handler.ts index 3aec8050c..23ad10b7f 100644 --- a/src/addon/mod/assign/providers/prefetch-handler.ts +++ b/src/addon/mod/assign/providers/prefetch-handler.ts @@ -230,8 +230,6 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan siteId = siteId || this.sitesProvider.getCurrentSiteId(); - promises.push(this.courseProvider.getModuleBasicInfo(module.id, siteId)); - // Get assignment to retrieve all its submissions. promises.push(this.assignProvider.getAssignment(courseId, module.id, siteId).then((assign) => { const subPromises = [], diff --git a/src/addon/mod/lesson/providers/prefetch-handler.ts b/src/addon/mod/lesson/providers/prefetch-handler.ts index 30fbc8a1d..17de0a1dd 100644 --- a/src/addon/mod/lesson/providers/prefetch-handler.ts +++ b/src/addon/mod/lesson/providers/prefetch-handler.ts @@ -358,9 +358,6 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan // Prefetch question attempts in last retake for offline calculations. promises.push(this.lessonProvider.getQuestionsAttemptsOnline(lesson.id, retake, false, undefined, false, true, siteId)); - // Get module info to be able to handle links. - promises.push(this.courseProvider.getModuleBasicInfo(module.id, siteId)); - if (accessInfo.canviewreports) { // Prefetch reports data. promises.push(this.groupsProvider.getActivityAllowedGroupsIfEnabled(module.id, undefined, siteId).then((groups) => { diff --git a/src/addon/mod/resource/providers/prefetch-handler.ts b/src/addon/mod/resource/providers/prefetch-handler.ts index 1a2342acf..30b75932b 100644 --- a/src/addon/mod/resource/providers/prefetch-handler.ts +++ b/src/addon/mod/resource/providers/prefetch-handler.ts @@ -70,11 +70,6 @@ export class AddonModResourcePrefetchHandler extends CoreCourseResourcePrefetchH promises.push(this.resourceProvider.getResourceData(courseId, module.id)); } - /* When prefetching we usually use ignoreCache=true. However, this WS call can return a lot of data, so if - a user downloads resources 1 by 1 we would be downloading the same data over and over again. Since - this data won't change often it's probably better to use ignoreCache=false. */ - promises.push(this.courseProvider.getModule(module.id, courseId, undefined, false, false, undefined, this.modName)); - return Promise.all(promises); }); } diff --git a/src/addon/mod/wiki/providers/prefetch-handler.ts b/src/addon/mod/wiki/providers/prefetch-handler.ts index 6f131ab58..a8848db0c 100644 --- a/src/addon/mod/wiki/providers/prefetch-handler.ts +++ b/src/addon/mod/wiki/providers/prefetch-handler.ts @@ -201,7 +201,6 @@ export class AddonModWikiPrefetchHandler extends CoreCourseActivityPrefetchHandl promises.push(this.wikiProvider.getWiki(courseId, module.id, false, siteId).then((wiki) => { return this.courseHelper.getModuleCourseIdByInstance(wiki.id, 'wiki', siteId); })); - promises.push(this.courseProvider.getModuleBasicInfo(module.id, siteId)); // Get related page files and fetch them. promises.push(this.getFiles(module, courseId, single, siteId).then((files) => { diff --git a/src/core/course/classes/activity-prefetch-handler.ts b/src/core/course/classes/activity-prefetch-handler.ts index 72805ca21..3c0294a93 100644 --- a/src/core/course/classes/activity-prefetch-handler.ts +++ b/src/core/course/classes/activity-prefetch-handler.ts @@ -101,8 +101,13 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe } const prefetchPromise = this.setDownloading(module.id, siteId).then(() => { - // Package marked as downloading, call the download function. - // Send all the params except downloadFn. This includes all params passed after siteId. + // Package marked as downloading, get module info to be able to handle links. + return Promise.all([ + this.courseProvider.getModuleBasicInfo(module.id, siteId), + this.courseProvider.getModule(module.id, courseId, undefined, false, true, siteId), + ]); + }).then(() => { + // Call the download function, send all the params except downloadFn. This includes all params passed after siteId. return downloadFn.apply(downloadFn, [module, courseId, single, siteId].concat(args)); }).then((extra: any) => { // Only accept string types. diff --git a/src/core/course/classes/resource-prefetch-handler.ts b/src/core/course/classes/resource-prefetch-handler.ts index b707e2086..f2e51246b 100644 --- a/src/core/course/classes/resource-prefetch-handler.ts +++ b/src/core/course/classes/resource-prefetch-handler.ts @@ -61,8 +61,11 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe return this.getOngoingDownload(module.id, siteId); } - // Load module contents (ignore cache so we always have the latest data). - const prefetchPromise = this.loadContents(module, courseId, true).then(() => { + // Get module info to be able to handle links. + const prefetchPromise = this.courseProvider.getModuleBasicInfo(module.id, siteId).then(() => { + // Load module contents (ignore cache so we always have the latest data). + return this.loadContents(module, courseId, true); + }).then(() => { // Get the intro files. return this.getIntroFiles(module, courseId); }).then((introFiles) => {