Skip videos count on client if we don't use it
This commit is contained in:
parent
fe98765624
commit
440d39c52d
|
@ -25,12 +25,14 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
channelPagination: ComponentPagination = {
|
channelPagination: ComponentPagination = {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
itemsPerPage: 2
|
itemsPerPage: 2,
|
||||||
|
totalItems: null
|
||||||
}
|
}
|
||||||
|
|
||||||
videosPagination: ComponentPagination = {
|
videosPagination: ComponentPagination = {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
itemsPerPage: 12
|
itemsPerPage: 12,
|
||||||
|
totalItems: null
|
||||||
}
|
}
|
||||||
videosSort: VideoSortField = '-publishedAt'
|
videosSort: VideoSortField = '-publishedAt'
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ export class PluginListInstalledComponent implements OnInit {
|
||||||
|
|
||||||
pagination: ComponentPagination = {
|
pagination: ComponentPagination = {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
itemsPerPage: 10
|
itemsPerPage: 10,
|
||||||
|
totalItems: null
|
||||||
}
|
}
|
||||||
sort = 'name'
|
sort = 'name'
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ export class PluginSearchComponent implements OnInit {
|
||||||
|
|
||||||
pagination: ComponentPagination = {
|
pagination: ComponentPagination = {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
itemsPerPage: 10
|
itemsPerPage: 10,
|
||||||
|
totalItems: null
|
||||||
}
|
}
|
||||||
sort = '-popularity'
|
sort = '-popularity'
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { catchError, map, switchMap } from 'rxjs/operators'
|
||||||
import { HttpClient, HttpParams } from '@angular/common/http'
|
import { HttpClient, HttpParams } from '@angular/common/http'
|
||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { Observable } from 'rxjs'
|
import { Observable } from 'rxjs'
|
||||||
import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
|
import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model'
|
||||||
import { VideoService } from '@app/shared/video/video.service'
|
import { VideoService } from '@app/shared/video/video.service'
|
||||||
import { RestExtractor, RestService } from '@app/shared'
|
import { RestExtractor, RestService } from '@app/shared'
|
||||||
import { environment } from '../../environments/environment'
|
import { environment } from '../../environments/environment'
|
||||||
|
@ -25,7 +25,7 @@ export class SearchService {
|
||||||
|
|
||||||
searchVideos (parameters: {
|
searchVideos (parameters: {
|
||||||
search: string,
|
search: string,
|
||||||
componentPagination: ComponentPagination,
|
componentPagination: ComponentPaginationLight,
|
||||||
advancedSearch: AdvancedSearch
|
advancedSearch: AdvancedSearch
|
||||||
}): Observable<ResultList<Video>> {
|
}): Observable<ResultList<Video>> {
|
||||||
const { search, componentPagination, advancedSearch } = parameters
|
const { search, componentPagination, advancedSearch } = parameters
|
||||||
|
@ -51,7 +51,7 @@ export class SearchService {
|
||||||
|
|
||||||
searchVideoChannels (parameters: {
|
searchVideoChannels (parameters: {
|
||||||
search: string,
|
search: string,
|
||||||
componentPagination: ComponentPagination
|
componentPagination: ComponentPaginationLight
|
||||||
}): Observable<ResultList<VideoChannel>> {
|
}): Observable<ResultList<VideoChannel>> {
|
||||||
const { search, componentPagination } = parameters
|
const { search, componentPagination } = parameters
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
export interface ComponentPagination {
|
export interface ComponentPagination {
|
||||||
currentPage: number
|
currentPage: number
|
||||||
itemsPerPage: number
|
itemsPerPage: number
|
||||||
totalItems?: number
|
totalItems: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ComponentPaginationLight = Omit<ComponentPagination, 'totalItems'>
|
||||||
|
|
||||||
export function hasMoreItems (componentPagination: ComponentPagination) {
|
export function hasMoreItems (componentPagination: ComponentPagination) {
|
||||||
// No results
|
// No results
|
||||||
if (componentPagination.totalItems === 0) return false
|
if (componentPagination.totalItems === 0) return false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { HttpParams } from '@angular/common/http'
|
import { HttpParams } from '@angular/common/http'
|
||||||
import { SortMeta } from 'primeng/components/common/sortmeta'
|
import { SortMeta } from 'primeng/components/common/sortmeta'
|
||||||
import { ComponentPagination } from './component-pagination.model'
|
import { ComponentPagination, ComponentPaginationLight } from './component-pagination.model'
|
||||||
|
|
||||||
import { RestPagination } from './rest-pagination'
|
import { RestPagination } from './rest-pagination'
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ export class RestService {
|
||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
componentPaginationToRestPagination (componentPagination: ComponentPagination): RestPagination {
|
componentPaginationToRestPagination (componentPagination: ComponentPaginationLight): RestPagination {
|
||||||
const start: number = (componentPagination.currentPage - 1) * componentPagination.itemsPerPage
|
const start: number = (componentPagination.currentPage - 1) * componentPagination.itemsPerPage
|
||||||
const count: number = componentPagination.itemsPerPage
|
const count: number = componentPagination.itemsPerPage
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { Observable, ReplaySubject, Subject } from 'rxjs'
|
||||||
import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
|
import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
|
||||||
import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
|
import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
|
||||||
import { VideoChannel as VideoChannelServer } from '../../../../../shared/models/videos'
|
import { VideoChannel as VideoChannelServer } from '../../../../../shared/models/videos'
|
||||||
import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
|
import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model'
|
||||||
|
|
||||||
type SubscriptionExistResult = { [ uri: string ]: boolean }
|
type SubscriptionExistResult = { [ uri: string ]: boolean }
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export class UserSubscriptionService {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
listSubscriptions (componentPagination: ComponentPagination): Observable<ResultList<VideoChannel>> {
|
listSubscriptions (componentPagination: ComponentPaginationLight): Observable<ResultList<VideoChannel>> {
|
||||||
const url = UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL
|
const url = UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL
|
||||||
|
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(componentPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(componentPagination)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { RestExtractor } from '../rest/rest-extractor.service'
|
||||||
import { RestService } from '../rest/rest.service'
|
import { RestService } from '../rest/rest.service'
|
||||||
import { Video } from '../video/video.model'
|
import { Video } from '../video/video.model'
|
||||||
import { catchError, map, switchMap } from 'rxjs/operators'
|
import { catchError, map, switchMap } from 'rxjs/operators'
|
||||||
import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
|
import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model'
|
||||||
import { VideoService } from '@app/shared/video/video.service'
|
import { VideoService } from '@app/shared/video/video.service'
|
||||||
import { ResultList } from '../../../../../shared'
|
import { ResultList } from '../../../../../shared'
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ export class UserHistoryService {
|
||||||
private videoService: VideoService
|
private videoService: VideoService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
getUserVideosHistory (historyPagination: ComponentPagination) {
|
getUserVideosHistory (historyPagination: ComponentPaginationLight) {
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(historyPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(historyPagination)
|
||||||
|
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { environment } from '../../../environments/environment'
|
||||||
import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '../../../../../shared'
|
import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '../../../../../shared'
|
||||||
import { UserNotification } from './user-notification.model'
|
import { UserNotification } from './user-notification.model'
|
||||||
import { AuthService } from '../../core'
|
import { AuthService } from '../../core'
|
||||||
import { ComponentPagination } from '../rest/component-pagination.model'
|
import { ComponentPaginationLight } from '../rest/component-pagination.model'
|
||||||
import { User } from '../users/user.model'
|
import { User } from '../users/user.model'
|
||||||
import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service'
|
import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service'
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ export class UserNotificationService {
|
||||||
private userNotificationSocket: UserNotificationSocket
|
private userNotificationSocket: UserNotificationSocket
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
listMyNotifications (pagination: ComponentPagination, unread?: boolean, ignoreLoadingBar = false) {
|
listMyNotifications (pagination: ComponentPaginationLight, unread?: boolean, ignoreLoadingBar = false) {
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
params = this.restService.addRestGetParams(params, this.restService.componentPaginationToRestPagination(pagination))
|
params = this.restService.addRestGetParams(params, this.restService.componentPaginationToRestPagination(pagination))
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { VideoBlacklist, VideoBlacklistType, ResultList } from '../../../../../s
|
||||||
import { Video } from '../video/video.model'
|
import { Video } from '../video/video.model'
|
||||||
import { environment } from '../../../environments/environment'
|
import { environment } from '../../../environments/environment'
|
||||||
import { RestExtractor, RestPagination, RestService } from '../rest'
|
import { RestExtractor, RestPagination, RestService } from '../rest'
|
||||||
import { ComponentPagination } from '../rest/component-pagination.model'
|
import { ComponentPaginationLight } from '../rest/component-pagination.model'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class VideoBlacklistService {
|
export class VideoBlacklistService {
|
||||||
|
@ -34,7 +34,7 @@ export class VideoBlacklistService {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
getAutoBlacklistedAsVideoList (videoPagination: ComponentPagination): Observable<ResultList<Video>> {
|
getAutoBlacklistedAsVideoList (videoPagination: ComponentPaginationLight): Observable<ResultList<Video>> {
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
||||||
|
|
||||||
// prioritize first created since waiting longest
|
// prioritize first created since waiting longest
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { VideoChannel } from './video-channel.model'
|
||||||
import { environment } from '../../../environments/environment'
|
import { environment } from '../../../environments/environment'
|
||||||
import { Account } from '@app/shared/account/account.model'
|
import { Account } from '@app/shared/account/account.model'
|
||||||
import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
|
import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
|
||||||
import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
|
import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model'
|
||||||
import { RestService } from '@app/shared/rest'
|
import { RestService } from '@app/shared/rest'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -44,7 +44,7 @@ export class VideoChannelService {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
listAccountVideoChannels (account: Account, componentPagination?: ComponentPagination): Observable<ResultList<VideoChannel>> {
|
listAccountVideoChannels (account: Account, componentPagination?: ComponentPaginationLight): Observable<ResultList<VideoChannel>> {
|
||||||
const pagination = componentPagination
|
const pagination = componentPagination
|
||||||
? this.restService.componentPaginationToRestPagination(componentPagination)
|
? this.restService.componentPaginationToRestPagination(componentPagination)
|
||||||
: { start: 0, count: 20 }
|
: { start: 0, count: 20 }
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { Account } from '@app/shared/account/account.model'
|
||||||
import { RestService } from '@app/shared/rest'
|
import { RestService } from '@app/shared/rest'
|
||||||
import { VideoExistInPlaylist, VideosExistInPlaylists } from '@shared/models/videos/playlist/video-exist-in-playlist.model'
|
import { VideoExistInPlaylist, VideosExistInPlaylists } from '@shared/models/videos/playlist/video-exist-in-playlist.model'
|
||||||
import { VideoPlaylistReorder } from '@shared/models/videos/playlist/video-playlist-reorder.model'
|
import { VideoPlaylistReorder } from '@shared/models/videos/playlist/video-playlist-reorder.model'
|
||||||
import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
|
import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model'
|
||||||
import { VideoPlaylistElement as ServerVideoPlaylistElement } from '@shared/models/videos/playlist/video-playlist-element.model'
|
import { VideoPlaylistElement as ServerVideoPlaylistElement } from '@shared/models/videos/playlist/video-playlist-element.model'
|
||||||
import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model'
|
import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model'
|
||||||
import { uniq } from 'lodash-es'
|
import { uniq } from 'lodash-es'
|
||||||
|
@ -63,7 +63,7 @@ export class VideoPlaylistService {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
listChannelPlaylists (videoChannel: VideoChannel, componentPagination: ComponentPagination): Observable<ResultList<VideoPlaylist>> {
|
listChannelPlaylists (videoChannel: VideoChannel, componentPagination: ComponentPaginationLight): Observable<ResultList<VideoPlaylist>> {
|
||||||
const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/video-playlists'
|
const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/video-playlists'
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(componentPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(componentPagination)
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ export class VideoPlaylistService {
|
||||||
|
|
||||||
listAccountPlaylists (
|
listAccountPlaylists (
|
||||||
account: Account,
|
account: Account,
|
||||||
componentPagination: ComponentPagination,
|
componentPagination: ComponentPaginationLight,
|
||||||
sort: string,
|
sort: string,
|
||||||
search?: string
|
search?: string
|
||||||
): Observable<ResultList<VideoPlaylist>> {
|
): Observable<ResultList<VideoPlaylist>> {
|
||||||
|
@ -236,7 +236,7 @@ export class VideoPlaylistService {
|
||||||
|
|
||||||
getPlaylistVideos (
|
getPlaylistVideos (
|
||||||
videoPlaylistId: number | string,
|
videoPlaylistId: number | string,
|
||||||
componentPagination: ComponentPagination
|
componentPagination: ComponentPaginationLight
|
||||||
): Observable<ResultList<VideoPlaylistElement>> {
|
): Observable<ResultList<VideoPlaylistElement>> {
|
||||||
const path = VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylistId + '/videos'
|
const path = VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylistId + '/videos'
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(componentPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(componentPagination)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { OnDestroy, OnInit } from '@angular/core'
|
||||||
import { ActivatedRoute, Router } from '@angular/router'
|
import { ActivatedRoute, Router } from '@angular/router'
|
||||||
import { fromEvent, Observable, of, Subject, Subscription } from 'rxjs'
|
import { fromEvent, Observable, of, Subject, Subscription } from 'rxjs'
|
||||||
import { AuthService } from '../../core/auth'
|
import { AuthService } from '../../core/auth'
|
||||||
import { ComponentPagination } from '../rest/component-pagination.model'
|
import { ComponentPaginationLight } from '../rest/component-pagination.model'
|
||||||
import { VideoSortField } from './sort-field.type'
|
import { VideoSortField } from './sort-field.type'
|
||||||
import { Video } from './video.model'
|
import { Video } from './video.model'
|
||||||
import { ScreenService } from '@app/shared/misc/screen.service'
|
import { ScreenService } from '@app/shared/misc/screen.service'
|
||||||
|
@ -13,7 +13,7 @@ import { Notifier, ServerService } from '@app/core'
|
||||||
import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook'
|
import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook'
|
||||||
import { I18n } from '@ngx-translate/i18n-polyfill'
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date'
|
import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date'
|
||||||
import { ResultList, ServerConfig } from '@shared/models'
|
import { ServerConfig } from '@shared/models'
|
||||||
|
|
||||||
enum GroupDate {
|
enum GroupDate {
|
||||||
UNKNOWN = 0,
|
UNKNOWN = 0,
|
||||||
|
@ -25,10 +25,9 @@ enum GroupDate {
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableForReuseHook {
|
export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableForReuseHook {
|
||||||
pagination: ComponentPagination = {
|
pagination: ComponentPaginationLight = {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
itemsPerPage: 25,
|
itemsPerPage: 25
|
||||||
totalItems: null
|
|
||||||
}
|
}
|
||||||
sort: VideoSortField = '-publishedAt'
|
sort: VideoSortField = '-publishedAt'
|
||||||
|
|
||||||
|
@ -47,6 +46,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
|
||||||
groupByDate = false
|
groupByDate = false
|
||||||
|
|
||||||
videos: Video[] = []
|
videos: Video[] = []
|
||||||
|
hasDoneFirstQuery = false
|
||||||
disabled = false
|
disabled = false
|
||||||
|
|
||||||
displayOptions: MiniatureDisplayOptions = {
|
displayOptions: MiniatureDisplayOptions = {
|
||||||
|
@ -84,7 +84,9 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
|
||||||
private groupedDateLabels: { [id in GroupDate]: string }
|
private groupedDateLabels: { [id in GroupDate]: string }
|
||||||
private groupedDates: { [id: number]: GroupDate } = {}
|
private groupedDates: { [id: number]: GroupDate } = {}
|
||||||
|
|
||||||
abstract getVideosObservable (page: number): Observable<ResultList<Video>>
|
private lastQueryLength: number
|
||||||
|
|
||||||
|
abstract getVideosObservable (page: number): Observable<{ data: Video[] }>
|
||||||
|
|
||||||
abstract generateSyndicationList (): void
|
abstract generateSyndicationList (): void
|
||||||
|
|
||||||
|
@ -142,8 +144,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
|
||||||
onNearOfBottom () {
|
onNearOfBottom () {
|
||||||
if (this.disabled) return
|
if (this.disabled) return
|
||||||
|
|
||||||
// Last page
|
// No more results
|
||||||
if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return
|
if (this.lastQueryLength !== undefined && this.lastQueryLength < this.pagination.itemsPerPage) return
|
||||||
|
|
||||||
this.pagination.currentPage += 1
|
this.pagination.currentPage += 1
|
||||||
|
|
||||||
|
@ -154,8 +156,10 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
|
||||||
|
|
||||||
loadMoreVideos (reset = false) {
|
loadMoreVideos (reset = false) {
|
||||||
this.getVideosObservable(this.pagination.currentPage).subscribe(
|
this.getVideosObservable(this.pagination.currentPage).subscribe(
|
||||||
({ data, total }) => {
|
({ data }) => {
|
||||||
this.pagination.totalItems = total
|
this.hasDoneFirstQuery = true
|
||||||
|
this.lastQueryLength = data.length
|
||||||
|
|
||||||
if (reset) this.videos = []
|
if (reset) this.videos = []
|
||||||
this.videos = this.videos.concat(data)
|
this.videos = this.videos.concat(data)
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
} from '../../../../../shared/models/videos'
|
} from '../../../../../shared/models/videos'
|
||||||
import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
|
import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
|
||||||
import { environment } from '../../../environments/environment'
|
import { environment } from '../../../environments/environment'
|
||||||
import { ComponentPagination } from '../rest/component-pagination.model'
|
import { ComponentPaginationLight } from '../rest/component-pagination.model'
|
||||||
import { RestExtractor } from '../rest/rest-extractor.service'
|
import { RestExtractor } from '../rest/rest-extractor.service'
|
||||||
import { RestService } from '../rest/rest.service'
|
import { RestService } from '../rest/rest.service'
|
||||||
import { UserService } from '../users/user.service'
|
import { UserService } from '../users/user.service'
|
||||||
|
@ -34,7 +34,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
|
|
||||||
export interface VideosProvider {
|
export interface VideosProvider {
|
||||||
getVideos (parameters: {
|
getVideos (parameters: {
|
||||||
videoPagination: ComponentPagination,
|
videoPagination: ComponentPaginationLight,
|
||||||
sort: VideoSortField,
|
sort: VideoSortField,
|
||||||
filter?: VideoFilter,
|
filter?: VideoFilter,
|
||||||
categoryOneOf?: number,
|
categoryOneOf?: number,
|
||||||
|
@ -121,7 +121,7 @@ export class VideoService implements VideosProvider {
|
||||||
.pipe(catchError(err => this.restExtractor.handleError(err)))
|
.pipe(catchError(err => this.restExtractor.handleError(err)))
|
||||||
}
|
}
|
||||||
|
|
||||||
getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField, search?: string): Observable<ResultList<Video>> {
|
getMyVideos (videoPagination: ComponentPaginationLight, sort: VideoSortField, search?: string): Observable<ResultList<Video>> {
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
||||||
|
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
|
@ -138,7 +138,7 @@ export class VideoService implements VideosProvider {
|
||||||
|
|
||||||
getAccountVideos (
|
getAccountVideos (
|
||||||
account: Account,
|
account: Account,
|
||||||
videoPagination: ComponentPagination,
|
videoPagination: ComponentPaginationLight,
|
||||||
sort: VideoSortField
|
sort: VideoSortField
|
||||||
): Observable<ResultList<Video>> {
|
): Observable<ResultList<Video>> {
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
||||||
|
@ -156,7 +156,7 @@ export class VideoService implements VideosProvider {
|
||||||
|
|
||||||
getVideoChannelVideos (
|
getVideoChannelVideos (
|
||||||
videoChannel: VideoChannel,
|
videoChannel: VideoChannel,
|
||||||
videoPagination: ComponentPagination,
|
videoPagination: ComponentPaginationLight,
|
||||||
sort: VideoSortField
|
sort: VideoSortField
|
||||||
): Observable<ResultList<Video>> {
|
): Observable<ResultList<Video>> {
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
||||||
|
@ -173,15 +173,18 @@ export class VideoService implements VideosProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserSubscriptionVideos (parameters: {
|
getUserSubscriptionVideos (parameters: {
|
||||||
videoPagination: ComponentPagination,
|
videoPagination: ComponentPaginationLight,
|
||||||
sort: VideoSortField
|
sort: VideoSortField,
|
||||||
|
skipCount?: boolean
|
||||||
}): Observable<ResultList<Video>> {
|
}): Observable<ResultList<Video>> {
|
||||||
const { videoPagination, sort } = parameters
|
const { videoPagination, sort, skipCount } = parameters
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
||||||
|
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
params = this.restService.addRestGetParams(params, pagination, sort)
|
params = this.restService.addRestGetParams(params, pagination, sort)
|
||||||
|
|
||||||
|
if (skipCount) params = params.set('skipCount', skipCount + '')
|
||||||
|
|
||||||
return this.authHttp
|
return this.authHttp
|
||||||
.get<ResultList<Video>>(UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL + '/videos', { params })
|
.get<ResultList<Video>>(UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL + '/videos', { params })
|
||||||
.pipe(
|
.pipe(
|
||||||
|
@ -191,26 +194,23 @@ export class VideoService implements VideosProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
getVideos (parameters: {
|
getVideos (parameters: {
|
||||||
videoPagination: ComponentPagination,
|
videoPagination: ComponentPaginationLight,
|
||||||
sort: VideoSortField,
|
sort: VideoSortField,
|
||||||
filter?: VideoFilter,
|
filter?: VideoFilter,
|
||||||
categoryOneOf?: number,
|
categoryOneOf?: number,
|
||||||
languageOneOf?: string[]
|
languageOneOf?: string[],
|
||||||
|
skipCount?: boolean
|
||||||
}): Observable<ResultList<Video>> {
|
}): Observable<ResultList<Video>> {
|
||||||
const { videoPagination, sort, filter, categoryOneOf, languageOneOf } = parameters
|
const { videoPagination, sort, filter, categoryOneOf, languageOneOf, skipCount } = parameters
|
||||||
|
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
||||||
|
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
params = this.restService.addRestGetParams(params, pagination, sort)
|
params = this.restService.addRestGetParams(params, pagination, sort)
|
||||||
|
|
||||||
if (filter) {
|
if (filter) params = params.set('filter', filter)
|
||||||
params = params.set('filter', filter)
|
if (categoryOneOf) params = params.set('categoryOneOf', categoryOneOf + '')
|
||||||
}
|
if (skipCount) params = params.set('skipCount', skipCount + '')
|
||||||
|
|
||||||
if (categoryOneOf) {
|
|
||||||
params = params.set('categoryOneOf', categoryOneOf + '')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (languageOneOf) {
|
if (languageOneOf) {
|
||||||
for (const l of languageOneOf) {
|
for (const l of languageOneOf) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { HttpClient, HttpParams } from '@angular/common/http'
|
||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { objectLineFeedToHtml } from '@app/shared/misc/utils'
|
import { objectLineFeedToHtml } from '@app/shared/misc/utils'
|
||||||
import { Observable } from 'rxjs'
|
import { Observable } from 'rxjs'
|
||||||
import { ResultList, FeedFormat } from '../../../../../../shared/models'
|
import { FeedFormat, ResultList } from '../../../../../../shared/models'
|
||||||
import {
|
import {
|
||||||
VideoComment as VideoCommentServerModel,
|
VideoComment as VideoCommentServerModel,
|
||||||
VideoCommentCreate,
|
VideoCommentCreate,
|
||||||
|
@ -11,7 +11,7 @@ import {
|
||||||
} from '../../../../../../shared/models/videos/video-comment.model'
|
} from '../../../../../../shared/models/videos/video-comment.model'
|
||||||
import { environment } from '../../../../environments/environment'
|
import { environment } from '../../../../environments/environment'
|
||||||
import { RestExtractor, RestService } from '../../../shared/rest'
|
import { RestExtractor, RestService } from '../../../shared/rest'
|
||||||
import { ComponentPagination } from '../../../shared/rest/component-pagination.model'
|
import { ComponentPaginationLight } from '../../../shared/rest/component-pagination.model'
|
||||||
import { CommentSortField } from '../../../shared/video/sort-field.type'
|
import { CommentSortField } from '../../../shared/video/sort-field.type'
|
||||||
import { VideoComment } from './video-comment.model'
|
import { VideoComment } from './video-comment.model'
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ export class VideoCommentService {
|
||||||
|
|
||||||
getVideoCommentThreads (parameters: {
|
getVideoCommentThreads (parameters: {
|
||||||
videoId: number | string,
|
videoId: number | string,
|
||||||
componentPagination: ComponentPagination,
|
componentPagination: ComponentPaginationLight,
|
||||||
sort: CommentSortField
|
sort: CommentSortField
|
||||||
}): Observable<ResultList<VideoComment>> {
|
}): Observable<ResultList<VideoComment>> {
|
||||||
const { videoId, componentPagination, sort } = parameters
|
const { videoId, componentPagination, sort } = parameters
|
||||||
|
|
|
@ -62,7 +62,8 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On
|
||||||
sort: this.sort,
|
sort: this.sort,
|
||||||
filter: this.filter,
|
filter: this.filter,
|
||||||
categoryOneOf: this.categoryOneOf,
|
categoryOneOf: this.categoryOneOf,
|
||||||
languageOneOf: this.languageOneOf
|
languageOneOf: this.languageOneOf,
|
||||||
|
skipCount: true
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.hooks.wrapObsFun(
|
return this.hooks.wrapObsFun(
|
||||||
|
|
|
@ -50,7 +50,8 @@ export class VideoMostLikedComponent extends AbstractVideoList implements OnInit
|
||||||
videoPagination: newPagination,
|
videoPagination: newPagination,
|
||||||
sort: this.sort,
|
sort: this.sort,
|
||||||
categoryOneOf: this.categoryOneOf,
|
categoryOneOf: this.categoryOneOf,
|
||||||
languageOneOf: this.languageOneOf
|
languageOneOf: this.languageOneOf,
|
||||||
|
skipCount: true
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.hooks.wrapObsFun(
|
return this.hooks.wrapObsFun(
|
||||||
|
|
|
@ -54,7 +54,8 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
|
||||||
videoPagination: newPagination,
|
videoPagination: newPagination,
|
||||||
sort: this.sort,
|
sort: this.sort,
|
||||||
categoryOneOf: this.categoryOneOf,
|
categoryOneOf: this.categoryOneOf,
|
||||||
languageOneOf: this.languageOneOf
|
languageOneOf: this.languageOneOf,
|
||||||
|
skipCount: true
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.hooks.wrapObsFun(
|
return this.hooks.wrapObsFun(
|
||||||
|
|
|
@ -67,7 +67,8 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit,
|
||||||
videoPagination: newPagination,
|
videoPagination: newPagination,
|
||||||
sort: this.sort,
|
sort: this.sort,
|
||||||
categoryOneOf: this.categoryOneOf,
|
categoryOneOf: this.categoryOneOf,
|
||||||
languageOneOf: this.languageOneOf
|
languageOneOf: this.languageOneOf,
|
||||||
|
skipCount: true
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.hooks.wrapObsFun(
|
return this.hooks.wrapObsFun(
|
||||||
|
|
|
@ -55,7 +55,8 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement
|
||||||
const newPagination = immutableAssign(this.pagination, { currentPage: page })
|
const newPagination = immutableAssign(this.pagination, { currentPage: page })
|
||||||
const params = {
|
const params = {
|
||||||
videoPagination: newPagination,
|
videoPagination: newPagination,
|
||||||
sort: this.sort
|
sort: this.sort,
|
||||||
|
skipCount: true
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.hooks.wrapObsFun(
|
return this.hooks.wrapObsFun(
|
||||||
|
|
Loading…
Reference in New Issue