Merge pull request #3365 from dpalou/MOBILE-3978

MOBILE-3978 calendar: Add fallback for access info
main
Pau Ferrer Ocaña 2022-09-01 11:42:48 +02:00 committed by GitHub
commit 302a4bc821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -160,14 +160,20 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
* @return Promise resolved when done.
*/
protected async fetchData(): Promise<void> {
let accessInfo: AddonCalendarGetCalendarAccessInformationWSResponse;
this.error = false;
// Get access info.
try {
accessInfo = await AddonCalendar.getAccessInformation(this.courseId);
this.types = await AddonCalendar.getAllowedEventTypes(this.courseId);
const [types, accessInfo] = await Promise.all([
AddonCalendar.getAllowedEventTypes(this.courseId),
CoreUtils.ignoreErrors(AddonCalendar.getAccessInformation(this.courseId), {
canmanageentries: false,
canmanageownentries: false,
canmanagegroupentries: false,
} as AddonCalendarGetCalendarAccessInformationWSResponse),
]);
this.types = types;
const promises: Promise<void>[] = [];
const eventTypes = AddonCalendarHelper.getEventTypeOptions(this.types);