diff --git a/src/addons/enrol/guest/services/guest.ts b/src/addons/enrol/guest/services/guest.ts index 8f08ae71d..333bb5a79 100644 --- a/src/addons/enrol/guest/services/guest.ts +++ b/src/addons/enrol/guest/services/guest.ts @@ -68,15 +68,11 @@ export class AddonEnrolGuestService { * * @param instanceId Guest instance ID. * @param siteId Site Id. If not defined, use current site. - * @returns Promise resolved when the data is invalidated. */ async invalidateGuestEnrolmentInfo(instanceId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); - await Promise.all([ - site.invalidateWsCacheForKey(this.getGuestEnrolmentInfoCacheKey(instanceId)), - site.invalidateWsCacheForKey(`mmCourses:guestinfo:${instanceId}`), // @todo Remove after 4.3 release. - ]); + await site.invalidateWsCacheForKey(this.getGuestEnrolmentInfoCacheKey(instanceId)); } /** diff --git a/src/core/features/courses/services/courses.ts b/src/core/features/courses/services/courses.ts index 666960711..b61d698a4 100644 --- a/src/core/features/courses/services/courses.ts +++ b/src/core/features/courses/services/courses.ts @@ -22,9 +22,8 @@ import { CoreCourseAnyCourseDataWithExtraInfoAndOptions, CoreCourseWithImageAndC import { asyncObservable, ignoreErrors, zipIncludingComplete } from '@/core/utils/rxjs'; import { of, firstValueFrom } from 'rxjs'; import { map } from 'rxjs/operators'; -import { AddonEnrolGuest, AddonEnrolGuestInfo } from '@addons/enrol/guest/services/guest'; -import { AddonEnrolSelf } from '@addons/enrol/self/services/self'; -import { CoreEnrol, CoreEnrolEnrolmentInfo, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol'; +import { AddonEnrolGuestInfo } from '@addons/enrol/guest/services/guest'; +import { CoreEnrolEnrolmentInfo, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol'; import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/authenticated-site'; import { CoreCacheUpdateFrequency } from '@/core/constants'; import { @@ -347,6 +346,8 @@ export class CoreCoursesProvider { * @deprecated since 4.3. Use CoreEnrol.getSupportedCourseEnrolmentMethods instead. */ async getCourseEnrolmentMethods(courseId: number, siteId?: string): Promise { + const { CoreEnrol } = await import('@features/enrol/services/enrol'); + return CoreEnrol.getSupportedCourseEnrolmentMethods(courseId, { siteId }); } @@ -359,6 +360,8 @@ export class CoreCoursesProvider { * @deprecated since 4.3 use AddonEnrolGuest.getCourseGuestEnrolmentInfo instead. */ async getCourseGuestEnrolmentInfo(instanceId: number, siteId?: string): Promise { + const { AddonEnrolGuest } = await import('@addons/enrol/guest/services/guest'); + return AddonEnrolGuest.getGuestEnrolmentInfo(instanceId, siteId); } @@ -1062,11 +1065,12 @@ export class CoreCoursesProvider { * * @param courseId Course ID. * @param siteId Site Id. If not defined, use current site. - * @returns Promise resolved when the data is invalidated. * @deprecated since 4.3 use CoreEnrol.invalidateCourseEnrolmentMethods instead. */ async invalidateCourseEnrolmentMethods(courseId: number, siteId?: string): Promise { - return CoreEnrol.invalidateCourseEnrolmentMethods(courseId, siteId); + const { CoreEnrol } = await import('@features/enrol/services/enrol'); + + await CoreEnrol.invalidateCourseEnrolmentMethods(courseId, siteId); } /** @@ -1074,11 +1078,12 @@ export class CoreCoursesProvider { * * @param instanceId Guest instance ID. * @param siteId Site Id. If not defined, use current site. - * @returns Promise resolved when the data is invalidated. * @deprecated since 4.3 use CoreEnrolDelegate.invalidate instead. */ async invalidateCourseGuestEnrolmentInfo(instanceId: number, siteId?: string): Promise { - return AddonEnrolGuest.invalidateGuestEnrolmentInfo(instanceId, siteId); + const { AddonEnrolGuest } = await import('@addons/enrol/guest/services/guest'); + + await AddonEnrolGuest.invalidateGuestEnrolmentInfo(instanceId, siteId); } /** @@ -1274,6 +1279,8 @@ export class CoreCoursesProvider { * @deprecated since 4.3 use CoreEnrolDelegate.enrol instead. */ async selfEnrol(courseId: number, password: string = '', instanceId?: number, siteId?: string): Promise { + const { AddonEnrolSelf } = await import('@addons/enrol/self/services/self'); + return AddonEnrolSelf.selfEnrol(courseId, password, instanceId, siteId); }