Revert "Adding confirmation before disconnect"

This reverts commit 732c123d44.
This commit is contained in:
shamoon
2024-02-06 14:50:25 -08:00
parent 732c123d44
commit bbcca2205d

View File

@@ -1,12 +1,11 @@
import { Component, OnDestroy, OnInit } from '@angular/core'
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 { SocialAccount, SocialAccountProvider } from 'src/app/data/user-profile'
import { ToastService } from 'src/app/services/toast.service'
import { Subject, takeUntil } from 'rxjs'
import { Clipboard } from '@angular/cdk/clipboard'
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component'
@Component({
selector: 'pngx-profile-edit-dialog',
@@ -47,8 +46,7 @@ export class ProfileEditDialogComponent implements OnInit, OnDestroy {
private profileService: ProfileService,
public activeModal: NgbActiveModal,
private toastService: ToastService,
private clipboard: Clipboard,
private modalService: NgbModal
private clipboard: Clipboard
) {}
ngOnInit(): void {
@@ -198,30 +196,19 @@ export class ProfileEditDialogComponent implements OnInit, OnDestroy {
}
disconnectSocialAccount(id: number): void {
let modal = this.modalService.open(ConfirmDialogComponent, {
backdrop: 'static',
})
modal.componentInstance.title = $localize`Confirm disconnecting the social account`
modal.componentInstance.messageBold = $localize`The social account will be disconnected and can no longer be used to log in.`
modal.componentInstance.message = $localize`This operation cannot be undone but you can connect the account again.`
modal.componentInstance.btnClass = 'btn-danger'
modal.componentInstance.btnCaption = $localize`Proceed`
modal.componentInstance.confirmClicked.subscribe(() => {
modal.componentInstance.buttonsEnabled = false
this.profileService
.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
)
},
})
})
this.profileService
.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
)
},
})
}
}