Merge pull request #3346 from dpalou/MOBILE-4081
MOBILE-4081 core: Remove some unneeded invalidatesmain
commit
3b0e94be4e
|
@ -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
|
||||
|
|
|
@ -1041,13 +1041,13 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
|
|||
* @param courseId Course ID the module belongs to.
|
||||
* @return Promise resolved when finished.
|
||||
*/
|
||||
syncModules(modules: CoreCourseModuleData[], courseId: number): Promise<unknown> {
|
||||
return Promise.all(modules.map(async (module) => {
|
||||
await this.syncModule(module, courseId);
|
||||
|
||||
async syncModules(modules: CoreCourseModuleData[], courseId: number): Promise<void> {
|
||||
try {
|
||||
await Promise.all(modules.map((module) => this.syncModule(module, courseId)));
|
||||
} finally {
|
||||
// Invalidate course updates.
|
||||
await CoreUtils.ignoreErrors(this.invalidateCourseUpdates(courseId));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue