Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(frontend:users): properly update websocket connection on admin impersonation and return

johaven5cf1e751a259
diff --git a/frontend/src/app/applications/users/user.service.ts b/frontend/src/app/applications/users/user.service.ts
index 4f391847..c643e615 100644
--- a/frontend/src/app/applications/users/user.service.ts
+++ b/frontend/src/app/applications/users/user.service.ts
@@ -87,6 +87,9 @@ export class UserService {
this.store.userImpersonate.set(impersonate || user.impersonated)
this.store.user.next(user)
this.checkQuota(this.store.user.getValue())
+ if (impersonate) {
+ this.disconnectWebSocket()
+ }
this.connectWebSocket()
}
diff --git a/frontend/src/app/auth/auth.service.ts b/frontend/src/app/auth/auth.service.ts
index 9479121b..36030a26 100644
--- a/frontend/src/app/auth/auth.service.ts
+++ b/frontend/src/app/auth/auth.service.ts
@@ -135,6 +135,7 @@ export class AuthService {
logoutImpersonateUser() {
this.http.post<LoginResponseDto>(API_ADMIN_IMPERSONATE_LOGOUT, null).subscribe({
next: (r: LoginResponseDto) => {
+ this.userService.disconnectWebSocket()
this.initUserFromResponse(r)
this.router.navigate([USER_PATH.BASE, USER_PATH.ACCOUNT]).catch((e: Error) => console.error(e))
},