aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.component.ts
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/app.component.ts
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/app.component.ts')
-rw-r--r--client/src/app/app.component.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 065bdcaa4..64bfb9671 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -12,6 +12,7 @@ import { PlatformLocation, ViewportScroller } from '@angular/common'
12import { PluginService } from '@app/core/plugins/plugin.service' 12import { PluginService } from '@app/core/plugins/plugin.service'
13import { HooksService } from '@app/core/plugins/hooks.service' 13import { HooksService } from '@app/core/plugins/hooks.service'
14import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 14import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
15import { POP_STATE_MODAL_DISMISS } from '@app/shared/misc/constants'
15 16
16@Component({ 17@Component({
17 selector: 'my-app', 18 selector: 'my-app',
@@ -94,7 +95,7 @@ export class AppComponent implements OnInit {
94 .pipe(debounceTime(200)) 95 .pipe(debounceTime(200))
95 .subscribe(() => this.onResize()) 96 .subscribe(() => this.onResize())
96 97
97 this.location.onPopState(() => this.modalService.dismissAll()) 98 this.location.onPopState(() => this.modalService.dismissAll(POP_STATE_MODAL_DISMISS))
98 } 99 }
99 100
100 isUserLoggedIn () { 101 isUserLoggedIn () {
@@ -115,7 +116,6 @@ export class AppComponent implements OnInit {
115 const eventsObs = this.router.events 116 const eventsObs = this.router.events
116 117
117 const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll)) 118 const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll))
118 const navigationEndEvent = eventsObs.pipe(filter((e: Event): e is NavigationEnd => e instanceof NavigationEnd))
119 119
120 scrollEvent.subscribe(e => { 120 scrollEvent.subscribe(e => {
121 if (e.position) { 121 if (e.position) {
@@ -131,6 +131,8 @@ export class AppComponent implements OnInit {
131 } 131 }
132 }) 132 })
133 133
134 const navigationEndEvent = eventsObs.pipe(filter((e: Event): e is NavigationEnd => e instanceof NavigationEnd))
135
134 // When we add the a-state parameter, we don't want to alter the scroll 136 // When we add the a-state parameter, we don't want to alter the scroll
135 navigationEndEvent.pipe(pairwise()) 137 navigationEndEvent.pipe(pairwise())
136 .subscribe(([ e1, e2 ]) => { 138 .subscribe(([ e1, e2 ]) => {