From 70ebf23d9e7edfdd156c66ec176f1dab66990de9 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 7 Jul 2026 11:12:07 +0200 Subject: [PATCH] Improve user account deletion flow --- .../user-account-settings.component.ts | 21 +++- .../user-account-settings.html | 118 ++++++++++-------- 2 files changed, 83 insertions(+), 56 deletions(-) diff --git a/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts b/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts index 09d099f39..6ef7d947e 100644 --- a/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts +++ b/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts @@ -1,3 +1,4 @@ +import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { KEY_STAY_SIGNED_IN, KEY_TOKEN, @@ -76,6 +77,8 @@ export class GfUserAccountSettingsComponent implements OnInit { public deleteOwnUserForm = this.formBuilder.group({ accessToken: ['', Validators.required] }); + public hasImpersonationId: boolean; + public hasPermissionForSubscription: boolean; public hasPermissionToDeleteOwnUser: boolean; public hasPermissionToUpdateViewMode: boolean; public hasPermissionToUpdateUserSettings: boolean; @@ -108,17 +111,33 @@ export class GfUserAccountSettingsComponent implements OnInit { private dataService: DataService, private destroyRef: DestroyRef, private formBuilder: FormBuilder, + private impersonationStorageService: ImpersonationStorageService, private notificationService: NotificationService, private settingsStorageService: SettingsStorageService, private snackBar: MatSnackBar, private userService: UserService, public webAuthnService: WebAuthnService ) { - const { baseCurrency, currencies } = this.dataService.fetchInfo(); + const { baseCurrency, currencies, globalPermissions } = + this.dataService.fetchInfo(); this.baseCurrency = baseCurrency; this.currencies = currencies; + this.hasPermissionForSubscription = hasPermission( + globalPermissions, + permissions.enableSubscription + ); + + this.impersonationStorageService + .onChangeHasImpersonation() + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe((impersonationId) => { + this.hasImpersonationId = !!impersonationId; + + this.changeDetectorRef.markForCheck(); + }); + this.userService.stateChanged .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe((state) => { diff --git a/apps/client/src/app/components/user-account-settings/user-account-settings.html b/apps/client/src/app/components/user-account-settings/user-account-settings.html index 9306839dd..59f8cd45e 100644 --- a/apps/client/src/app/components/user-account-settings/user-account-settings.html +++ b/apps/client/src/app/components/user-account-settings/user-account-settings.html @@ -285,67 +285,75 @@ -