Merge pull request #3346 from dpalou/MOBILE-4081

MOBILE-4081 core: Remove some unneeded invalidates
main
Pau Ferrer Ocaña 2022-07-13 11:10:31 +02:00 committed by GitHub
commit 3b0e94be4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -16,8 +16,7 @@ import { Injectable, Type } from '@angular/core';
import { AddonModForum, AddonModForumProvider } from '../forum'; import { AddonModForum, AddonModForumProvider } from '../forum';
import { makeSingleton, Translate } from '@singletons'; import { makeSingleton, Translate } from '@singletons';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
import { CoreSites } from '@services/sites'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@features/course/services/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@features/course/services/module-delegate';
import { CoreConstants, ModPurpose } from '@/core/constants'; import { CoreConstants, ModPurpose } from '@/core/constants';
import { AddonModForumIndexComponent } from '../../components/index'; import { AddonModForumIndexComponent } from '../../components/index';
@ -115,11 +114,12 @@ export class AddonModForumModuleHandlerService extends CoreModuleHandlerBase imp
data.extraBadge = Translate.instant('core.loading'); data.extraBadge = Translate.instant('core.loading');
data.extraBadgeColor = CoreIonicColorNames.DARK; data.extraBadgeColor = CoreIonicColorNames.DARK;
await CoreUtils.ignoreErrors(AddonModForum.invalidateForumData(courseId));
try { try {
// Handle unread posts. // 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.extraBadgeColor = undefined;
data.extraBadge = forum.unreadpostscount data.extraBadge = forum.unreadpostscount

View File

@ -1041,13 +1041,13 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
* @param courseId Course ID the module belongs to. * @param courseId Course ID the module belongs to.
* @return Promise resolved when finished. * @return Promise resolved when finished.
*/ */
syncModules(modules: CoreCourseModuleData[], courseId: number): Promise<unknown> { async syncModules(modules: CoreCourseModuleData[], courseId: number): Promise<void> {
return Promise.all(modules.map(async (module) => { try {
await this.syncModule(module, courseId); await Promise.all(modules.map((module) => this.syncModule(module, courseId)));
} finally {
// Invalidate course updates. // Invalidate course updates.
await CoreUtils.ignoreErrors(this.invalidateCourseUpdates(courseId)); await CoreUtils.ignoreErrors(this.invalidateCourseUpdates(courseId));
})); }
} }
/** /**