diff --git a/src/core/features/course/components/module-summary/module-summary.html b/src/core/features/course/components/module-summary/module-summary.html index 6c60ba185..52dc0f284 100644 --- a/src/core/features/course/components/module-summary/module-summary.html +++ b/src/core/features/course/components/module-summary/module-summary.html @@ -37,7 +37,7 @@ {{ 'core.course' | translate}}

- +

diff --git a/src/core/features/course/components/module-summary/module-summary.ts b/src/core/features/course/components/module-summary/module-summary.ts index a82c4801c..f480c8469 100644 --- a/src/core/features/course/components/module-summary/module-summary.ts +++ b/src/core/features/course/components/module-summary/module-summary.ts @@ -249,7 +249,13 @@ export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy { * Fetch course. */ protected async fetchCourse(): Promise { - this.course = await CoreCourses.getUserCourse(this.courseId, true); + // Fix that. + try { + this.course = await CoreCourses.getUserCourse(this.courseId, true); + } catch { + // The user is not enrolled in the course. Use getCourses to see if it's an admin/manager and can see the course. + this.course = await CoreCourses.getCourse(this.courseId); + } } /**