diff --git a/src/addon/mod/data/providers/prefetch-handler.ts b/src/addon/mod/data/providers/prefetch-handler.ts index 631599d5b..63d531b8a 100644 --- a/src/addon/mod/data/providers/prefetch-handler.ts +++ b/src/addon/mod/data/providers/prefetch-handler.ts @@ -282,6 +282,7 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl return this.getDatabaseInfoHelper(module, courseId, false, false, true, siteId).then((info) => { // Prefetch the database data. const database = info.database, + commentsEnabled = !this.commentsProvider.areCommentsDisabledInSite(), promises = []; promises.push(this.dataProvider.getFields(database.id, false, true, siteId)); @@ -295,7 +296,7 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl info.entries.forEach((entry) => { promises.push(this.dataProvider.getEntry(database.id, entry.id, true, siteId)); - if (database.comments) { + if (commentsEnabled && database.comments) { promises.push(this.commentsProvider.getComments('module', database.coursemodule, 'mod_data', entry.id, 'database_entry', 0, siteId)); }