diff options
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/shared/shared-video-playlist/video-playlist.service.ts | 12 |
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' | |||
3 | import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators' | 3 | import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators' |
4 | import { HttpClient, HttpContext, HttpParams } from '@angular/common/http' | 4 | import { HttpClient, HttpContext, HttpParams } from '@angular/common/http' |
5 | import { Injectable } from '@angular/core' | 5 | import { Injectable } from '@angular/core' |
6 | import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core' | 6 | import { AuthService, AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core' |
7 | import { buildBulkObservable, objectToFormData } from '@app/helpers' | 7 | import { buildBulkObservable, objectToFormData } from '@app/helpers' |
8 | import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main' | 8 | import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main' |
9 | import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client' | 9 | import { 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 | ||