From 94c1430762dd1db5e3637f9b9cc474749909ee93 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 27 Jan 2022 16:28:45 +0100 Subject: [PATCH] MOBILE-3316 core: Handle wsaccessuserdeleted error --- src/core/classes/site.ts | 2 +- src/core/features/user/pages/profile/profile.page.ts | 2 +- src/core/services/utils/utils.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/classes/site.ts b/src/core/classes/site.ts index 50ba03d5c..dc702baf9 100644 --- a/src/core/classes/site.ts +++ b/src/core/classes/site.ts @@ -610,7 +610,7 @@ export class CoreSite { CoreEvents.trigger(CoreEvents.SESSION_EXPIRED, {}, this.id); // Change error message. Try to get data from cache, the event will handle the error. error.message = Translate.instant('core.lostconnection'); - } else if (error.errorcode === 'userdeleted') { + } else if (error.errorcode === 'userdeleted' || error.errorcode === 'wsaccessuserdeleted') { // User deleted, trigger event. CoreEvents.trigger(CoreEvents.USER_DELETED, { params: data }, this.id); error.message = Translate.instant('core.userdeleted'); diff --git a/src/core/features/user/pages/profile/profile.page.ts b/src/core/features/user/pages/profile/profile.page.ts index a4cdef678..ba3061238 100644 --- a/src/core/features/user/pages/profile/profile.page.ts +++ b/src/core/features/user/pages/profile/profile.page.ts @@ -114,7 +114,7 @@ export class CoreUserProfilePage implements OnInit, OnDestroy { try { await CoreUser.logView(this.userId, this.courseId, this.user.fullname); } catch (error) { - this.isDeleted = error?.errorcode === 'userdeleted'; + this.isDeleted = error?.errorcode === 'userdeleted' || error?.errorcode === 'wsaccessuserdeleted'; this.isSuspended = error?.errorcode === 'wsaccessusersuspended'; this.isEnrolled = error?.errorcode !== 'notenrolledprofile'; } diff --git a/src/core/services/utils/utils.ts b/src/core/services/utils/utils.ts index 9d79f6f63..b928c0e5e 100644 --- a/src/core/services/utils/utils.ts +++ b/src/core/services/utils/utils.ts @@ -862,7 +862,7 @@ export class CoreUtilsProvider { error.errorcode != 'userdeleted' && error.errorcode != 'upgraderunning' && error.errorcode != 'forcepasswordchangenotice' && error.errorcode != 'usernotfullysetup' && error.errorcode != 'sitepolicynotagreed' && error.errorcode != 'sitemaintenance' && - error.errorcode != 'wsaccessusersuspended' && + error.errorcode != 'wsaccessusersuspended' && error.errorcode != 'wsaccessuserdeleted' && !this.isExpiredTokenError(error))); }