MOBILE-3833 module: Fix get course when non enrolled
parent
8ba7da0552
commit
452acd45e9
|
@ -37,7 +37,7 @@
|
||||||
{{ 'core.course' | translate}}
|
{{ 'core.course' | translate}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<core-format-text [text]="course.displayname || course.fullname" contextLevel="course" [contextInstanceId]="courseId">
|
<core-format-text [text]="course.fullname" contextLevel="course" [contextInstanceId]="courseId">
|
||||||
</core-format-text>
|
</core-format-text>
|
||||||
</p>
|
</p>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
|
|
|
@ -249,7 +249,13 @@ export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy {
|
||||||
* Fetch course.
|
* Fetch course.
|
||||||
*/
|
*/
|
||||||
protected async fetchCourse(): Promise<void> {
|
protected async fetchCourse(): Promise<void> {
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue