X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fconfirm%2Fconfirm.component.ts;h=763454c4f8c9c2d88ec7610d9e3306458facfbb1;hb=dd4f25eea802fd88ea641d730432b56f562e0861;hp=63c163da68061c6582ef7d628f470cb959a3ccf5;hpb=28f3d1b36a70426795240c9370e47b6c4ba847f8;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/confirm/confirm.component.ts b/client/src/app/shared/confirm/confirm.component.ts index 63c163da6..763454c4f 100644 --- a/client/src/app/shared/confirm/confirm.component.ts +++ b/client/src/app/shared/confirm/confirm.component.ts @@ -3,6 +3,7 @@ import { ConfirmService } from '@app/core/confirm/confirm.service' import { I18n } from '@ngx-translate/i18n-polyfill' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' +import { POP_STATE_MODAL_DISMISS } from '@app/shared/misc/constants' @Component({ selector: 'my-confirm', @@ -10,7 +11,7 @@ import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' styleUrls: [ './confirm.component.scss' ] }) export class ConfirmComponent implements OnInit { - @ViewChild('confirmModal') confirmModal: ElementRef + @ViewChild('confirmModal', { static: true }) confirmModal: ElementRef title = '' message = '' @@ -63,6 +64,11 @@ export class ConfirmComponent implements OnInit { this.openedModal.result .then(() => this.confirmService.confirmResponse.next(true)) - .catch(() => this.confirmService.confirmResponse.next(false)) + .catch((reason: string) => { + // If the reason was that the user used the back button, we don't care about the confirm dialog result + if (!reason || reason !== POP_STATE_MODAL_DISMISS) { + this.confirmService.confirmResponse.next(false) + } + }) } }