Prevent fetching playlist status after logout

pull/5170/head
Chocobozzz 2022-07-28 16:26:34 +02:00
parent ce6b3765a2
commit 37b1d97f22
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs'
import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators' import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators'
import { HttpClient, HttpContext, HttpParams } from '@angular/common/http' import { HttpClient, HttpContext, HttpParams } from '@angular/common/http'
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core' import { AuthService, AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core'
import { buildBulkObservable, objectToFormData } from '@app/helpers' import { buildBulkObservable, objectToFormData } from '@app/helpers'
import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main' import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main'
import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client' import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client'
@ -46,6 +46,7 @@ export class VideoPlaylistService {
constructor ( constructor (
private authHttp: HttpClient, private authHttp: HttpClient,
private auth: AuthService,
private serverService: ServerService, private serverService: ServerService,
private restExtractor: RestExtractor, private restExtractor: RestExtractor,
private restService: RestService private restService: RestService
@ -53,7 +54,14 @@ export class VideoPlaylistService {
this.videoExistsInPlaylistObservable = merge( this.videoExistsInPlaylistObservable = merge(
buildBulkObservable({ buildBulkObservable({
time: 500, time: 500,
bulkGet: this.doVideosExistInPlaylist.bind(this), bulkGet: (videoIds: number[]) => {
// We added a delay to the request, so ensure the user is still logged in
if (this.auth.isLoggedIn()) {
return this.doVideosExistInPlaylist(videoIds)
}
return of({})
},
notifierObservable: this.videoExistsInPlaylistNotifier notifierObservable: this.videoExistsInPlaylistNotifier
}).pipe(map(({ response }) => response)), }).pipe(map(({ response }) => response)),