diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-08 14:40:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-08 14:40:08 +0100 |
commit | 440d39c52d4efb878b6a2e21584d6b8f52072f27 (patch) | |
tree | 19ffd2dd545e125daf89c230e33d15f7827d10f7 /client/src/app/shared | |
parent | fe98765624cdd6695739bda719fcb726b71c2b2a (diff) | |
download | PeerTube-440d39c52d4efb878b6a2e21584d6b8f52072f27.tar.gz PeerTube-440d39c52d4efb878b6a2e21584d6b8f52072f27.tar.zst PeerTube-440d39c52d4efb878b6a2e21584d6b8f52072f27.zip |
Skip videos count on client if we don't use it
Diffstat (limited to 'client/src/app/shared')
10 files changed, 51 insertions, 45 deletions
diff --git a/client/src/app/shared/rest/component-pagination.model.ts b/client/src/app/shared/rest/component-pagination.model.ts index 85160d445..bcb73ed0f 100644 --- a/client/src/app/shared/rest/component-pagination.model.ts +++ b/client/src/app/shared/rest/component-pagination.model.ts | |||
@@ -1,9 +1,11 @@ | |||
1 | export interface ComponentPagination { | 1 | export interface ComponentPagination { |
2 | currentPage: number | 2 | currentPage: number |
3 | itemsPerPage: number | 3 | itemsPerPage: number |
4 | totalItems?: number | 4 | totalItems: number |
5 | } | 5 | } |
6 | 6 | ||
7 | export type ComponentPaginationLight = Omit<ComponentPagination, 'totalItems'> | ||
8 | |||
7 | export function hasMoreItems (componentPagination: ComponentPagination) { | 9 | export function hasMoreItems (componentPagination: ComponentPagination) { |
8 | // No results | 10 | // No results |
9 | if (componentPagination.totalItems === 0) return false | 11 | if (componentPagination.totalItems === 0) return false |
diff --git a/client/src/app/shared/rest/rest.service.ts b/client/src/app/shared/rest/rest.service.ts index e6d4e6e5e..16bb6d82c 100644 --- a/client/src/app/shared/rest/rest.service.ts +++ b/client/src/app/shared/rest/rest.service.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Injectable } from '@angular/core' | 1 | import { Injectable } from '@angular/core' |
2 | import { HttpParams } from '@angular/common/http' | 2 | import { HttpParams } from '@angular/common/http' |
3 | import { SortMeta } from 'primeng/components/common/sortmeta' | 3 | import { SortMeta } from 'primeng/components/common/sortmeta' |
4 | import { ComponentPagination } from './component-pagination.model' | 4 | import { ComponentPagination, ComponentPaginationLight } from './component-pagination.model' |
5 | 5 | ||
6 | import { RestPagination } from './rest-pagination' | 6 | import { RestPagination } from './rest-pagination' |
7 | 7 | ||
@@ -47,7 +47,7 @@ export class RestService { | |||
47 | return params | 47 | return params |
48 | } | 48 | } |
49 | 49 | ||
50 | componentPaginationToRestPagination (componentPagination: ComponentPagination): RestPagination { | 50 | componentPaginationToRestPagination (componentPagination: ComponentPaginationLight): RestPagination { |
51 | const start: number = (componentPagination.currentPage - 1) * componentPagination.itemsPerPage | 51 | const start: number = (componentPagination.currentPage - 1) * componentPagination.itemsPerPage |
52 | const count: number = componentPagination.itemsPerPage | 52 | const count: number = componentPagination.itemsPerPage |
53 | 53 | ||
diff --git a/client/src/app/shared/user-subscription/user-subscription.service.ts b/client/src/app/shared/user-subscription/user-subscription.service.ts index cfd5b100f..83df40a43 100644 --- a/client/src/app/shared/user-subscription/user-subscription.service.ts +++ b/client/src/app/shared/user-subscription/user-subscription.service.ts | |||
@@ -8,7 +8,7 @@ import { Observable, ReplaySubject, Subject } from 'rxjs' | |||
8 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 8 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
9 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | 9 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
10 | import { VideoChannel as VideoChannelServer } from '../../../../../shared/models/videos' | 10 | import { VideoChannel as VideoChannelServer } from '../../../../../shared/models/videos' |
11 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 11 | import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' |
12 | 12 | ||
13 | type SubscriptionExistResult = { [ uri: string ]: boolean } | 13 | type SubscriptionExistResult = { [ uri: string ]: boolean } |
14 | 14 | ||
@@ -54,7 +54,7 @@ export class UserSubscriptionService { | |||
54 | ) | 54 | ) |
55 | } | 55 | } |
56 | 56 | ||
57 | listSubscriptions (componentPagination: ComponentPagination): Observable<ResultList<VideoChannel>> { | 57 | listSubscriptions (componentPagination: ComponentPaginationLight): Observable<ResultList<VideoChannel>> { |
58 | const url = UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL | 58 | const url = UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL |
59 | 59 | ||
60 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 60 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) |
diff --git a/client/src/app/shared/users/user-history.service.ts b/client/src/app/shared/users/user-history.service.ts index 9ed25bfc7..b358cdf20 100644 --- a/client/src/app/shared/users/user-history.service.ts +++ b/client/src/app/shared/users/user-history.service.ts | |||
@@ -5,7 +5,7 @@ import { RestExtractor } from '../rest/rest-extractor.service' | |||
5 | import { RestService } from '../rest/rest.service' | 5 | import { RestService } from '../rest/rest.service' |
6 | import { Video } from '../video/video.model' | 6 | import { Video } from '../video/video.model' |
7 | import { catchError, map, switchMap } from 'rxjs/operators' | 7 | import { catchError, map, switchMap } from 'rxjs/operators' |
8 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 8 | import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' |
9 | import { VideoService } from '@app/shared/video/video.service' | 9 | import { VideoService } from '@app/shared/video/video.service' |
10 | import { ResultList } from '../../../../../shared' | 10 | import { ResultList } from '../../../../../shared' |
11 | 11 | ||
@@ -20,7 +20,7 @@ export class UserHistoryService { | |||
20 | private videoService: VideoService | 20 | private videoService: VideoService |
21 | ) {} | 21 | ) {} |
22 | 22 | ||
23 | getUserVideosHistory (historyPagination: ComponentPagination) { | 23 | getUserVideosHistory (historyPagination: ComponentPaginationLight) { |
24 | const pagination = this.restService.componentPaginationToRestPagination(historyPagination) | 24 | const pagination = this.restService.componentPaginationToRestPagination(historyPagination) |
25 | 25 | ||
26 | let params = new HttpParams() | 26 | let params = new HttpParams() |
diff --git a/client/src/app/shared/users/user-notification.service.ts b/client/src/app/shared/users/user-notification.service.ts index ae0bc9cb1..e525a1d58 100644 --- a/client/src/app/shared/users/user-notification.service.ts +++ b/client/src/app/shared/users/user-notification.service.ts | |||
@@ -6,7 +6,7 @@ import { environment } from '../../../environments/environment' | |||
6 | import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '../../../../../shared' | 6 | import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '../../../../../shared' |
7 | import { UserNotification } from './user-notification.model' | 7 | import { UserNotification } from './user-notification.model' |
8 | import { AuthService } from '../../core' | 8 | import { AuthService } from '../../core' |
9 | import { ComponentPagination } from '../rest/component-pagination.model' | 9 | import { ComponentPaginationLight } from '../rest/component-pagination.model' |
10 | import { User } from '../users/user.model' | 10 | import { User } from '../users/user.model' |
11 | import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service' | 11 | import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service' |
12 | 12 | ||
@@ -23,7 +23,7 @@ export class UserNotificationService { | |||
23 | private userNotificationSocket: UserNotificationSocket | 23 | private userNotificationSocket: UserNotificationSocket |
24 | ) {} | 24 | ) {} |
25 | 25 | ||
26 | listMyNotifications (pagination: ComponentPagination, unread?: boolean, ignoreLoadingBar = false) { | 26 | listMyNotifications (pagination: ComponentPaginationLight, unread?: boolean, ignoreLoadingBar = false) { |
27 | let params = new HttpParams() | 27 | let params = new HttpParams() |
28 | params = this.restService.addRestGetParams(params, this.restService.componentPaginationToRestPagination(pagination)) | 28 | params = this.restService.addRestGetParams(params, this.restService.componentPaginationToRestPagination(pagination)) |
29 | 29 | ||
diff --git a/client/src/app/shared/video-blacklist/video-blacklist.service.ts b/client/src/app/shared/video-blacklist/video-blacklist.service.ts index d65da85fe..491fa698b 100644 --- a/client/src/app/shared/video-blacklist/video-blacklist.service.ts +++ b/client/src/app/shared/video-blacklist/video-blacklist.service.ts | |||
@@ -7,7 +7,7 @@ import { VideoBlacklist, VideoBlacklistType, ResultList } from '../../../../../s | |||
7 | import { Video } from '../video/video.model' | 7 | import { Video } from '../video/video.model' |
8 | import { environment } from '../../../environments/environment' | 8 | import { environment } from '../../../environments/environment' |
9 | import { RestExtractor, RestPagination, RestService } from '../rest' | 9 | import { RestExtractor, RestPagination, RestService } from '../rest' |
10 | import { ComponentPagination } from '../rest/component-pagination.model' | 10 | import { ComponentPaginationLight } from '../rest/component-pagination.model' |
11 | 11 | ||
12 | @Injectable() | 12 | @Injectable() |
13 | export class VideoBlacklistService { | 13 | export class VideoBlacklistService { |
@@ -34,7 +34,7 @@ export class VideoBlacklistService { | |||
34 | ) | 34 | ) |
35 | } | 35 | } |
36 | 36 | ||
37 | getAutoBlacklistedAsVideoList (videoPagination: ComponentPagination): Observable<ResultList<Video>> { | 37 | getAutoBlacklistedAsVideoList (videoPagination: ComponentPaginationLight): Observable<ResultList<Video>> { |
38 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 38 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
39 | 39 | ||
40 | // prioritize first created since waiting longest | 40 | // prioritize first created since waiting longest |
diff --git a/client/src/app/shared/video-channel/video-channel.service.ts b/client/src/app/shared/video-channel/video-channel.service.ts index 0168d37d9..adb4f4819 100644 --- a/client/src/app/shared/video-channel/video-channel.service.ts +++ b/client/src/app/shared/video-channel/video-channel.service.ts | |||
@@ -10,7 +10,7 @@ import { VideoChannel } from './video-channel.model' | |||
10 | import { environment } from '../../../environments/environment' | 10 | import { environment } from '../../../environments/environment' |
11 | import { Account } from '@app/shared/account/account.model' | 11 | import { Account } from '@app/shared/account/account.model' |
12 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' | 12 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' |
13 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 13 | import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' |
14 | import { RestService } from '@app/shared/rest' | 14 | import { RestService } from '@app/shared/rest' |
15 | 15 | ||
16 | @Injectable() | 16 | @Injectable() |
@@ -44,7 +44,7 @@ export class VideoChannelService { | |||
44 | ) | 44 | ) |
45 | } | 45 | } |
46 | 46 | ||
47 | listAccountVideoChannels (account: Account, componentPagination?: ComponentPagination): Observable<ResultList<VideoChannel>> { | 47 | listAccountVideoChannels (account: Account, componentPagination?: ComponentPaginationLight): Observable<ResultList<VideoChannel>> { |
48 | const pagination = componentPagination | 48 | const pagination = componentPagination |
49 | ? this.restService.componentPaginationToRestPagination(componentPagination) | 49 | ? this.restService.componentPaginationToRestPagination(componentPagination) |
50 | : { start: 0, count: 20 } | 50 | : { start: 0, count: 20 } |
diff --git a/client/src/app/shared/video-playlist/video-playlist.service.ts b/client/src/app/shared/video-playlist/video-playlist.service.ts index 7eddf81e1..1ec9315ef 100644 --- a/client/src/app/shared/video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/video-playlist/video-playlist.service.ts | |||
@@ -18,7 +18,7 @@ import { Account } from '@app/shared/account/account.model' | |||
18 | import { RestService } from '@app/shared/rest' | 18 | import { RestService } from '@app/shared/rest' |
19 | import { VideoExistInPlaylist, VideosExistInPlaylists } from '@shared/models/videos/playlist/video-exist-in-playlist.model' | 19 | import { VideoExistInPlaylist, VideosExistInPlaylists } from '@shared/models/videos/playlist/video-exist-in-playlist.model' |
20 | import { VideoPlaylistReorder } from '@shared/models/videos/playlist/video-playlist-reorder.model' | 20 | import { VideoPlaylistReorder } from '@shared/models/videos/playlist/video-playlist-reorder.model' |
21 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 21 | import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' |
22 | import { VideoPlaylistElement as ServerVideoPlaylistElement } from '@shared/models/videos/playlist/video-playlist-element.model' | 22 | import { VideoPlaylistElement as ServerVideoPlaylistElement } from '@shared/models/videos/playlist/video-playlist-element.model' |
23 | import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' | 23 | import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' |
24 | import { uniq } from 'lodash-es' | 24 | import { uniq } from 'lodash-es' |
@@ -63,7 +63,7 @@ export class VideoPlaylistService { | |||
63 | ) | 63 | ) |
64 | } | 64 | } |
65 | 65 | ||
66 | listChannelPlaylists (videoChannel: VideoChannel, componentPagination: ComponentPagination): Observable<ResultList<VideoPlaylist>> { | 66 | listChannelPlaylists (videoChannel: VideoChannel, componentPagination: ComponentPaginationLight): Observable<ResultList<VideoPlaylist>> { |
67 | const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/video-playlists' | 67 | const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/video-playlists' |
68 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 68 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) |
69 | 69 | ||
@@ -90,7 +90,7 @@ export class VideoPlaylistService { | |||
90 | 90 | ||
91 | listAccountPlaylists ( | 91 | listAccountPlaylists ( |
92 | account: Account, | 92 | account: Account, |
93 | componentPagination: ComponentPagination, | 93 | componentPagination: ComponentPaginationLight, |
94 | sort: string, | 94 | sort: string, |
95 | search?: string | 95 | search?: string |
96 | ): Observable<ResultList<VideoPlaylist>> { | 96 | ): Observable<ResultList<VideoPlaylist>> { |
@@ -236,7 +236,7 @@ export class VideoPlaylistService { | |||
236 | 236 | ||
237 | getPlaylistVideos ( | 237 | getPlaylistVideos ( |
238 | videoPlaylistId: number | string, | 238 | videoPlaylistId: number | string, |
239 | componentPagination: ComponentPagination | 239 | componentPagination: ComponentPaginationLight |
240 | ): Observable<ResultList<VideoPlaylistElement>> { | 240 | ): Observable<ResultList<VideoPlaylistElement>> { |
241 | const path = VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylistId + '/videos' | 241 | const path = VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylistId + '/videos' |
242 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 242 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) |
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 06d4ed43d..c2fe6f754 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts | |||
@@ -3,7 +3,7 @@ import { OnDestroy, OnInit } from '@angular/core' | |||
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { fromEvent, Observable, of, Subject, Subscription } from 'rxjs' | 4 | import { fromEvent, Observable, of, Subject, Subscription } from 'rxjs' |
5 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
6 | import { ComponentPagination } from '../rest/component-pagination.model' | 6 | import { ComponentPaginationLight } from '../rest/component-pagination.model' |
7 | import { VideoSortField } from './sort-field.type' | 7 | import { VideoSortField } from './sort-field.type' |
8 | import { Video } from './video.model' | 8 | import { Video } from './video.model' |
9 | import { ScreenService } from '@app/shared/misc/screen.service' | 9 | import { ScreenService } from '@app/shared/misc/screen.service' |
@@ -13,7 +13,7 @@ import { Notifier, ServerService } from '@app/core' | |||
13 | import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' | 13 | import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' |
14 | import { I18n } from '@ngx-translate/i18n-polyfill' | 14 | import { I18n } from '@ngx-translate/i18n-polyfill' |
15 | import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date' | 15 | import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date' |
16 | import { ResultList, ServerConfig } from '@shared/models' | 16 | import { ServerConfig } from '@shared/models' |
17 | 17 | ||
18 | enum GroupDate { | 18 | enum GroupDate { |
19 | UNKNOWN = 0, | 19 | UNKNOWN = 0, |
@@ -25,10 +25,9 @@ enum GroupDate { | |||
25 | } | 25 | } |
26 | 26 | ||
27 | export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableForReuseHook { | 27 | export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableForReuseHook { |
28 | pagination: ComponentPagination = { | 28 | pagination: ComponentPaginationLight = { |
29 | currentPage: 1, | 29 | currentPage: 1, |
30 | itemsPerPage: 25, | 30 | itemsPerPage: 25 |
31 | totalItems: null | ||
32 | } | 31 | } |
33 | sort: VideoSortField = '-publishedAt' | 32 | sort: VideoSortField = '-publishedAt' |
34 | 33 | ||
@@ -47,6 +46,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
47 | groupByDate = false | 46 | groupByDate = false |
48 | 47 | ||
49 | videos: Video[] = [] | 48 | videos: Video[] = [] |
49 | hasDoneFirstQuery = false | ||
50 | disabled = false | 50 | disabled = false |
51 | 51 | ||
52 | displayOptions: MiniatureDisplayOptions = { | 52 | displayOptions: MiniatureDisplayOptions = { |
@@ -84,7 +84,9 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
84 | private groupedDateLabels: { [id in GroupDate]: string } | 84 | private groupedDateLabels: { [id in GroupDate]: string } |
85 | private groupedDates: { [id: number]: GroupDate } = {} | 85 | private groupedDates: { [id: number]: GroupDate } = {} |
86 | 86 | ||
87 | abstract getVideosObservable (page: number): Observable<ResultList<Video>> | 87 | private lastQueryLength: number |
88 | |||
89 | abstract getVideosObservable (page: number): Observable<{ data: Video[] }> | ||
88 | 90 | ||
89 | abstract generateSyndicationList (): void | 91 | abstract generateSyndicationList (): void |
90 | 92 | ||
@@ -142,8 +144,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
142 | onNearOfBottom () { | 144 | onNearOfBottom () { |
143 | if (this.disabled) return | 145 | if (this.disabled) return |
144 | 146 | ||
145 | // Last page | 147 | // No more results |
146 | if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return | 148 | if (this.lastQueryLength !== undefined && this.lastQueryLength < this.pagination.itemsPerPage) return |
147 | 149 | ||
148 | this.pagination.currentPage += 1 | 150 | this.pagination.currentPage += 1 |
149 | 151 | ||
@@ -154,8 +156,10 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
154 | 156 | ||
155 | loadMoreVideos (reset = false) { | 157 | loadMoreVideos (reset = false) { |
156 | this.getVideosObservable(this.pagination.currentPage).subscribe( | 158 | this.getVideosObservable(this.pagination.currentPage).subscribe( |
157 | ({ data, total }) => { | 159 | ({ data }) => { |
158 | this.pagination.totalItems = total | 160 | this.hasDoneFirstQuery = true |
161 | this.lastQueryLength = data.length | ||
162 | |||
159 | if (reset) this.videos = [] | 163 | if (reset) this.videos = [] |
160 | this.videos = this.videos.concat(data) | 164 | this.videos = this.videos.concat(data) |
161 | 165 | ||
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 2dd47d74e..996202154 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -15,7 +15,7 @@ import { | |||
15 | } from '../../../../../shared/models/videos' | 15 | } from '../../../../../shared/models/videos' |
16 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | 16 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' |
17 | import { environment } from '../../../environments/environment' | 17 | import { environment } from '../../../environments/environment' |
18 | import { ComponentPagination } from '../rest/component-pagination.model' | 18 | import { ComponentPaginationLight } from '../rest/component-pagination.model' |
19 | import { RestExtractor } from '../rest/rest-extractor.service' | 19 | import { RestExtractor } from '../rest/rest-extractor.service' |
20 | import { RestService } from '../rest/rest.service' | 20 | import { RestService } from '../rest/rest.service' |
21 | import { UserService } from '../users/user.service' | 21 | import { UserService } from '../users/user.service' |
@@ -34,7 +34,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
34 | 34 | ||
35 | export interface VideosProvider { | 35 | export interface VideosProvider { |
36 | getVideos (parameters: { | 36 | getVideos (parameters: { |
37 | videoPagination: ComponentPagination, | 37 | videoPagination: ComponentPaginationLight, |
38 | sort: VideoSortField, | 38 | sort: VideoSortField, |
39 | filter?: VideoFilter, | 39 | filter?: VideoFilter, |
40 | categoryOneOf?: number, | 40 | categoryOneOf?: number, |
@@ -121,7 +121,7 @@ export class VideoService implements VideosProvider { | |||
121 | .pipe(catchError(err => this.restExtractor.handleError(err))) | 121 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
122 | } | 122 | } |
123 | 123 | ||
124 | getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField, search?: string): Observable<ResultList<Video>> { | 124 | getMyVideos (videoPagination: ComponentPaginationLight, sort: VideoSortField, search?: string): Observable<ResultList<Video>> { |
125 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 125 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
126 | 126 | ||
127 | let params = new HttpParams() | 127 | let params = new HttpParams() |
@@ -138,7 +138,7 @@ export class VideoService implements VideosProvider { | |||
138 | 138 | ||
139 | getAccountVideos ( | 139 | getAccountVideos ( |
140 | account: Account, | 140 | account: Account, |
141 | videoPagination: ComponentPagination, | 141 | videoPagination: ComponentPaginationLight, |
142 | sort: VideoSortField | 142 | sort: VideoSortField |
143 | ): Observable<ResultList<Video>> { | 143 | ): Observable<ResultList<Video>> { |
144 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 144 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
@@ -156,7 +156,7 @@ export class VideoService implements VideosProvider { | |||
156 | 156 | ||
157 | getVideoChannelVideos ( | 157 | getVideoChannelVideos ( |
158 | videoChannel: VideoChannel, | 158 | videoChannel: VideoChannel, |
159 | videoPagination: ComponentPagination, | 159 | videoPagination: ComponentPaginationLight, |
160 | sort: VideoSortField | 160 | sort: VideoSortField |
161 | ): Observable<ResultList<Video>> { | 161 | ): Observable<ResultList<Video>> { |
162 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 162 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
@@ -173,15 +173,18 @@ export class VideoService implements VideosProvider { | |||
173 | } | 173 | } |
174 | 174 | ||
175 | getUserSubscriptionVideos (parameters: { | 175 | getUserSubscriptionVideos (parameters: { |
176 | videoPagination: ComponentPagination, | 176 | videoPagination: ComponentPaginationLight, |
177 | sort: VideoSortField | 177 | sort: VideoSortField, |
178 | skipCount?: boolean | ||
178 | }): Observable<ResultList<Video>> { | 179 | }): Observable<ResultList<Video>> { |
179 | const { videoPagination, sort } = parameters | 180 | const { videoPagination, sort, skipCount } = parameters |
180 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 181 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
181 | 182 | ||
182 | let params = new HttpParams() | 183 | let params = new HttpParams() |
183 | params = this.restService.addRestGetParams(params, pagination, sort) | 184 | params = this.restService.addRestGetParams(params, pagination, sort) |
184 | 185 | ||
186 | if (skipCount) params = params.set('skipCount', skipCount + '') | ||
187 | |||
185 | return this.authHttp | 188 | return this.authHttp |
186 | .get<ResultList<Video>>(UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL + '/videos', { params }) | 189 | .get<ResultList<Video>>(UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL + '/videos', { params }) |
187 | .pipe( | 190 | .pipe( |
@@ -191,26 +194,23 @@ export class VideoService implements VideosProvider { | |||
191 | } | 194 | } |
192 | 195 | ||
193 | getVideos (parameters: { | 196 | getVideos (parameters: { |
194 | videoPagination: ComponentPagination, | 197 | videoPagination: ComponentPaginationLight, |
195 | sort: VideoSortField, | 198 | sort: VideoSortField, |
196 | filter?: VideoFilter, | 199 | filter?: VideoFilter, |
197 | categoryOneOf?: number, | 200 | categoryOneOf?: number, |
198 | languageOneOf?: string[] | 201 | languageOneOf?: string[], |
202 | skipCount?: boolean | ||
199 | }): Observable<ResultList<Video>> { | 203 | }): Observable<ResultList<Video>> { |
200 | const { videoPagination, sort, filter, categoryOneOf, languageOneOf } = parameters | 204 | const { videoPagination, sort, filter, categoryOneOf, languageOneOf, skipCount } = parameters |
201 | 205 | ||
202 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 206 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
203 | 207 | ||
204 | let params = new HttpParams() | 208 | let params = new HttpParams() |
205 | params = this.restService.addRestGetParams(params, pagination, sort) | 209 | params = this.restService.addRestGetParams(params, pagination, sort) |
206 | 210 | ||
207 | if (filter) { | 211 | if (filter) params = params.set('filter', filter) |
208 | params = params.set('filter', filter) | 212 | if (categoryOneOf) params = params.set('categoryOneOf', categoryOneOf + '') |
209 | } | 213 | if (skipCount) params = params.set('skipCount', skipCount + '') |
210 | |||
211 | if (categoryOneOf) { | ||
212 | params = params.set('categoryOneOf', categoryOneOf + '') | ||
213 | } | ||
214 | 214 | ||
215 | if (languageOneOf) { | 215 | if (languageOneOf) { |
216 | for (const l of languageOneOf) { | 216 | for (const l of languageOneOf) { |