diff --git a/src/addons/mod/forum/services/handlers/module.ts b/src/addons/mod/forum/services/handlers/module.ts index 780f432b1..e55e46453 100644 --- a/src/addons/mod/forum/services/handlers/module.ts +++ b/src/addons/mod/forum/services/handlers/module.ts @@ -16,8 +16,7 @@ import { Injectable, Type } from '@angular/core'; import { AddonModForum, AddonModForumProvider } from '../forum'; import { makeSingleton, Translate } from '@singletons'; import { CoreEvents } from '@singletons/events'; -import { CoreSites } from '@services/sites'; -import { CoreUtils } from '@services/utils/utils'; +import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@features/course/services/module-delegate'; import { CoreConstants, ModPurpose } from '@/core/constants'; import { AddonModForumIndexComponent } from '../../components/index'; @@ -115,11 +114,12 @@ export class AddonModForumModuleHandlerService extends CoreModuleHandlerBase imp data.extraBadge = Translate.instant('core.loading'); data.extraBadgeColor = CoreIonicColorNames.DARK; - await CoreUtils.ignoreErrors(AddonModForum.invalidateForumData(courseId)); - try { // Handle unread posts. - const forum = await AddonModForum.getForum(courseId, moduleId, { siteId }); + const forum = await AddonModForum.getForum(courseId, moduleId, { + readingStrategy: CoreSitesReadingStrategy.PREFER_NETWORK, + siteId, + }); data.extraBadgeColor = undefined; data.extraBadge = forum.unreadpostscount diff --git a/src/core/features/course/services/module-prefetch-delegate.ts b/src/core/features/course/services/module-prefetch-delegate.ts index 992e069e8..25a659172 100644 --- a/src/core/features/course/services/module-prefetch-delegate.ts +++ b/src/core/features/course/services/module-prefetch-delegate.ts @@ -1041,13 +1041,13 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { - return Promise.all(modules.map(async (module) => { - await this.syncModule(module, courseId); - + async syncModules(modules: CoreCourseModuleData[], courseId: number): Promise { + try { + await Promise.all(modules.map((module) => this.syncModule(module, courseId))); + } finally { // Invalidate course updates. await CoreUtils.ignoreErrors(this.invalidateCourseUpdates(courseId)); - })); + } } /**