MOBILE-4009 course: Fix enrolment WS types
parent
e3b8d74b0d
commit
834743f096
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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?
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue