Browse Source

Improve user account deletion flow

pull/7269/head
Thomas Kaul 1 week ago
parent
commit
1c238c54e6
  1. 12
      apps/client/src/app/components/user-account-settings/user-account-settings.component.ts
  2. 5
      apps/client/src/app/components/user-account-settings/user-account-settings.html

12
apps/client/src/app/components/user-account-settings/user-account-settings.component.ts

@ -1,4 +1,3 @@
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
import { import {
KEY_STAY_SIGNED_IN, KEY_STAY_SIGNED_IN,
KEY_TOKEN, KEY_TOKEN,
@ -77,7 +76,6 @@ export class GfUserAccountSettingsComponent implements OnInit {
public deleteOwnUserForm = this.formBuilder.group({ public deleteOwnUserForm = this.formBuilder.group({
accessToken: ['', Validators.required] accessToken: ['', Validators.required]
}); });
public hasImpersonationId: boolean;
public hasPermissionForSubscription: boolean; public hasPermissionForSubscription: boolean;
public hasPermissionToDeleteOwnUser: boolean; public hasPermissionToDeleteOwnUser: boolean;
public hasPermissionToUpdateViewMode: boolean; public hasPermissionToUpdateViewMode: boolean;
@ -111,7 +109,6 @@ export class GfUserAccountSettingsComponent implements OnInit {
private dataService: DataService, private dataService: DataService,
private destroyRef: DestroyRef, private destroyRef: DestroyRef,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private impersonationStorageService: ImpersonationStorageService,
private notificationService: NotificationService, private notificationService: NotificationService,
private settingsStorageService: SettingsStorageService, private settingsStorageService: SettingsStorageService,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
@ -129,15 +126,6 @@ export class GfUserAccountSettingsComponent implements OnInit {
permissions.enableSubscription permissions.enableSubscription
); );
this.impersonationStorageService
.onChangeHasImpersonation()
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((impersonationId) => {
this.hasImpersonationId = !!impersonationId;
this.changeDetectorRef.markForCheck();
});
this.userService.stateChanged this.userService.stateChanged
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((state) => { .subscribe((state) => {

5
apps/client/src/app/components/user-account-settings/user-account-settings.html

@ -285,10 +285,7 @@
</button> </button>
</div> </div>
</div> </div>
@if ( @if (hasPermissionToDeleteOwnUser || hasPermissionForSubscription) {
!hasImpersonationId &&
(hasPermissionToDeleteOwnUser || hasPermissionForSubscription)
) {
<hr class="mt-5" /> <hr class="mt-5" />
<div class="d-flex py-1"> <div class="d-flex py-1">
<div class="pr-1 text-danger w-50" i18n>Danger Zone</div> <div class="pr-1 text-danger w-50" i18n>Danger Zone</div>

Loading…
Cancel
Save