Revert "Adding confirmation before disconnect"
This reverts commit 732c123d44.
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
import { Component, OnDestroy, OnInit } from '@angular/core'
|
import { Component, OnDestroy, OnInit } from '@angular/core'
|
||||||
import { FormControl, FormGroup } from '@angular/forms'
|
import { FormControl, FormGroup } from '@angular/forms'
|
||||||
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { ProfileService } from 'src/app/services/profile.service'
|
import { ProfileService } from 'src/app/services/profile.service'
|
||||||
import { SocialAccount, SocialAccountProvider } from 'src/app/data/user-profile'
|
import { SocialAccount, SocialAccountProvider } from 'src/app/data/user-profile'
|
||||||
import { ToastService } from 'src/app/services/toast.service'
|
import { ToastService } from 'src/app/services/toast.service'
|
||||||
import { Subject, takeUntil } from 'rxjs'
|
import { Subject, takeUntil } from 'rxjs'
|
||||||
import { Clipboard } from '@angular/cdk/clipboard'
|
import { Clipboard } from '@angular/cdk/clipboard'
|
||||||
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component'
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'pngx-profile-edit-dialog',
|
selector: 'pngx-profile-edit-dialog',
|
||||||
@@ -47,8 +46,7 @@ export class ProfileEditDialogComponent implements OnInit, OnDestroy {
|
|||||||
private profileService: ProfileService,
|
private profileService: ProfileService,
|
||||||
public activeModal: NgbActiveModal,
|
public activeModal: NgbActiveModal,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
private clipboard: Clipboard,
|
private clipboard: Clipboard
|
||||||
private modalService: NgbModal
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@@ -198,30 +196,19 @@ export class ProfileEditDialogComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
disconnectSocialAccount(id: number): void {
|
disconnectSocialAccount(id: number): void {
|
||||||
let modal = this.modalService.open(ConfirmDialogComponent, {
|
this.profileService
|
||||||
backdrop: 'static',
|
.disconnectSocialAccount(id)
|
||||||
})
|
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||||
modal.componentInstance.title = $localize`Confirm disconnecting the social account`
|
.subscribe({
|
||||||
modal.componentInstance.messageBold = $localize`The social account will be disconnected and can no longer be used to log in.`
|
next: (id: number) => {
|
||||||
modal.componentInstance.message = $localize`This operation cannot be undone but you can connect the account again.`
|
this.socialAccounts = this.socialAccounts.filter((a) => a.id != id)
|
||||||
modal.componentInstance.btnClass = 'btn-danger'
|
},
|
||||||
modal.componentInstance.btnCaption = $localize`Proceed`
|
error: (error) => {
|
||||||
modal.componentInstance.confirmClicked.subscribe(() => {
|
this.toastService.showError(
|
||||||
modal.componentInstance.buttonsEnabled = false
|
$localize`Error disconnecting social account`,
|
||||||
this.profileService
|
error
|
||||||
.disconnectSocialAccount(id)
|
)
|
||||||
.pipe(takeUntil(this.unsubscribeNotifier))
|
},
|
||||||
.subscribe({
|
})
|
||||||
next: (id: number) => {
|
|
||||||
this.socialAccounts = this.socialAccounts.filter((a) => a.id != id)
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
this.toastService.showError(
|
|
||||||
$localize`Error disconnecting social account`,
|
|
||||||
error
|
|
||||||
)
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user