aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-22 17:13:58 +0200
committerChocobozzz <me@florianbigard.com>2019-08-22 17:14:44 +0200
commit60c2bc80b82c71bd63bdb1fcf64d4d49491ce5c8 (patch)
treef9479065dc5d28bca46120ab0a29ed7074ab5fff /client/src/app/shared
parent4334445d043252661e62cf97f76b67a2c43e3750 (diff)
downloadPeerTube-60c2bc80b82c71bd63bdb1fcf64d4d49491ce5c8.tar.gz
PeerTube-60c2bc80b82c71bd63bdb1fcf64d4d49491ce5c8.tar.zst
PeerTube-60c2bc80b82c71bd63bdb1fcf64d4d49491ce5c8.zip
Go back when cancel NSFW modal
Instead of redirecting on the homepage
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/confirm/confirm.component.ts8
-rw-r--r--client/src/app/shared/misc/constants.ts1
2 files changed, 8 insertions, 1 deletions
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'
3import { I18n } from '@ngx-translate/i18n-polyfill' 3import { I18n } from '@ngx-translate/i18n-polyfill'
4import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 4import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
5import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' 5import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
6import { POP_STATE_MODAL_DISMISS } from '@app/shared/misc/constants'
6 7
7@Component({ 8@Component({
8 selector: 'my-confirm', 9 selector: 'my-confirm',
@@ -63,6 +64,11 @@ export class ConfirmComponent implements OnInit {
63 64
64 this.openedModal.result 65 this.openedModal.result
65 .then(() => this.confirmService.confirmResponse.next(true)) 66 .then(() => this.confirmService.confirmResponse.next(true))
66 .catch(() => this.confirmService.confirmResponse.next(false)) 67 .catch((reason: string) => {
68 // If the reason was that the user used the back button, we don't care about the confirm dialog result
69 if (!reason || reason !== POP_STATE_MODAL_DISMISS) {
70 this.confirmService.confirmResponse.next(false)
71 }
72 })
67 } 73 }
68} 74}
diff --git a/client/src/app/shared/misc/constants.ts b/client/src/app/shared/misc/constants.ts
new file mode 100644
index 000000000..bb4a0884e
--- /dev/null
+++ b/client/src/app/shared/misc/constants.ts
@@ -0,0 +1 @@
export const POP_STATE_MODAL_DISMISS = 'pop state dismiss'