aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-28 16:26:34 +0200
committerChocobozzz <me@florianbigard.com>2022-07-28 16:27:14 +0200
commit37b1d97f226aa83f47cb27eae00f2d2821759457 (patch)
treefeb2261a1002dba2e3ae53be770d4f172c72565d
parentce6b3765a2d31b9b90b7a1435e7180b91cba57b3 (diff)
downloadPeerTube-37b1d97f226aa83f47cb27eae00f2d2821759457.tar.gz
PeerTube-37b1d97f226aa83f47cb27eae00f2d2821759457.tar.zst
PeerTube-37b1d97f226aa83f47cb27eae00f2d2821759457.zip
Prevent fetching playlist status after logout
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist.service.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts
index 81ae0f292..d71f8f72e 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts
+++ b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts
@@ -3,7 +3,7 @@ import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs'
3import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators' 3import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators'
4import { HttpClient, HttpContext, HttpParams } from '@angular/common/http' 4import { HttpClient, HttpContext, HttpParams } from '@angular/common/http'
5import { Injectable } from '@angular/core' 5import { Injectable } from '@angular/core'
6import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core' 6import { AuthService, AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core'
7import { buildBulkObservable, objectToFormData } from '@app/helpers' 7import { buildBulkObservable, objectToFormData } from '@app/helpers'
8import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main' 8import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main'
9import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client' 9import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client'
@@ -46,6 +46,7 @@ export class VideoPlaylistService {
46 46
47 constructor ( 47 constructor (
48 private authHttp: HttpClient, 48 private authHttp: HttpClient,
49 private auth: AuthService,
49 private serverService: ServerService, 50 private serverService: ServerService,
50 private restExtractor: RestExtractor, 51 private restExtractor: RestExtractor,
51 private restService: RestService 52 private restService: RestService
@@ -53,7 +54,14 @@ export class VideoPlaylistService {
53 this.videoExistsInPlaylistObservable = merge( 54 this.videoExistsInPlaylistObservable = merge(
54 buildBulkObservable({ 55 buildBulkObservable({
55 time: 500, 56 time: 500,
56 bulkGet: this.doVideosExistInPlaylist.bind(this), 57 bulkGet: (videoIds: number[]) => {
58 // We added a delay to the request, so ensure the user is still logged in
59 if (this.auth.isLoggedIn()) {
60 return this.doVideosExistInPlaylist(videoIds)
61 }
62
63 return of({})
64 },
57 notifierObservable: this.videoExistsInPlaylistNotifier 65 notifierObservable: this.videoExistsInPlaylistNotifier
58 }).pipe(map(({ response }) => response)), 66 }).pipe(map(({ response }) => response)),
59 67