From 60c2bc80b82c71bd63bdb1fcf64d4d49491ce5c8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 22 Aug 2019 17:13:58 +0200 Subject: Go back when cancel NSFW modal Instead of redirecting on the homepage --- client/src/app/shared/confirm/confirm.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'client/src/app/shared/confirm/confirm.component.ts') diff --git a/client/src/app/shared/confirm/confirm.component.ts b/client/src/app/shared/confirm/confirm.component.ts index 53aed14d7..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', @@ -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) + } + }) } } -- cgit v1.2.3