diff --git a/src/core/features/course/pages/course-summary/course-summary.page.ts b/src/core/features/course/pages/course-summary/course-summary.page.ts index deffdadcd..fcae410d8 100644 --- a/src/core/features/course/pages/course-summary/course-summary.page.ts +++ b/src/core/features/course/pages/course-summary/course-summary.page.ts @@ -144,7 +144,7 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy { // Don't allow guest access if it requires a password if not supported. this.guestAccessPasswordRequired = info.passwordrequired; - return info.status === true && (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable()); + return info.status && (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable()); } /** @@ -193,7 +193,7 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy { const enrolmentMethods = await CoreCourses.getCourseEnrolmentMethods(this.courseId); enrolmentMethods.forEach((method) => { - if (!method.status) { + if (!CoreUtils.isTrueOrOne(method.status)) { return; } diff --git a/src/core/features/course/services/course-helper.ts b/src/core/features/course/services/course-helper.ts index 87ab3c580..7c02eb06f 100644 --- a/src/core/features/course/services/course-helper.ts +++ b/src/core/features/course/services/course-helper.ts @@ -634,8 +634,7 @@ export class CoreCourseHelperProvider { // Don't allow guest access if it requires a password and it's available. return { - guestAccess: info.status === true && - (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable()), + guestAccess: info.status && (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable()), passwordRequired: info.passwordrequired, }; } catch { diff --git a/src/core/features/courses/services/courses.ts b/src/core/features/courses/services/courses.ts index f65faaf96..c45c69da6 100644 --- a/src/core/features/courses/services/courses.ts +++ b/src/core/features/courses/services/courses.ts @@ -1827,7 +1827,6 @@ export type CoreCourseEnrolmentInfo = { courseid: number; // Id of course. type: string; // Type of enrolment plugin. name: string; // Name of enrolment plugin. - status: boolean | string; // Available status of enrolment plugin. True if successful, else error message or false. }; /** @@ -1835,6 +1834,7 @@ export type CoreCourseEnrolmentInfo = { */ export type CoreCourseEnrolmentMethod = CoreCourseEnrolmentInfo & { wsfunction?: string; // Webservice function to get more information. + status: string; // Status of enrolment plugin. True if successful, else error message or false. }; /** @@ -1877,6 +1877,7 @@ export type CoreCourseGetRecentCoursesOptions = CoreSitesCommonWSOptions & { */ export type CoreCourseEnrolmentGuestMethod = CoreCourseEnrolmentInfo & { passwordrequired: boolean; // Is a password required? + status: boolean; // Is the enrolment enabled? }; /** diff --git a/src/core/features/courses/services/handlers/course-link.ts b/src/core/features/courses/services/handlers/course-link.ts index 0a5af6e2a..c1c3d8b59 100644 --- a/src/core/features/courses/services/handlers/course-link.ts +++ b/src/core/features/courses/services/handlers/course-link.ts @@ -241,7 +241,7 @@ export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandler let isSelfEnrolEnabled = false; let instances = 0; methods.forEach((method) => { - if (method.type == 'self' && method.status) { + if (method.type == 'self' && CoreUtils.isTrueOrOne(method.status)) { isSelfEnrolEnabled = true; instances++; }