MOBILE-2877 data: Check comments disabled on prefetch

main
Pau Ferrer Ocaña 2019-11-28 13:11:55 +01:00
parent e6fd969855
commit 9f51f547c4
1 changed files with 2 additions and 1 deletions

View File

@ -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));
}