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 { 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
|
||||||
|
|
|
@ -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));
|
||||||
}));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue