]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-recently-added.component.ts
Skip videos count on client if we don't use it
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-recently-added.component.ts
CommitLineData
9af61e84 1import { Component, OnDestroy, OnInit } from '@angular/core'
9bf9d2a5 2import { ActivatedRoute, Router } from '@angular/router'
0cd4344f 3import { immutableAssign } from '@app/shared/misc/utils'
b2731bff 4import { AuthService } from '../../core/auth'
202f6b6c 5import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7b87d2d5 6import { VideoSortField } from '../../shared/video/sort-field.type'
f3aaa9a9 7import { VideoService } from '../../shared/video/video.service'
989e526a 8import { I18n } from '@ngx-translate/i18n-polyfill'
bbe0f064 9import { ScreenService } from '@app/shared/misc/screen.service'
489290b8 10import { Notifier, ServerService } from '@app/core'
93cae479 11import { HooksService } from '@app/core/plugins/hooks.service'
9bf9d2a5
C
12
13@Component({
14 selector: 'my-videos-recently-added',
202f6b6c
C
15 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
16 templateUrl: '../../shared/video/abstract-video-list.html'
9bf9d2a5 17})
9af61e84 18export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
989e526a 19 titlePage: string
136cce4d 20 sort: VideoSortField = '-publishedAt'
34c7f429 21 groupByDate = true
9bf9d2a5 22
3caf77d3
C
23 useUserVideoLanguagePreferences = true
24
989e526a 25 constructor (
34c7f429 26 protected i18n: I18n,
989e526a 27 protected route: ActivatedRoute,
489290b8
C
28 protected serverService: ServerService,
29 protected router: Router,
f8b2c1b4 30 protected notifier: Notifier,
989e526a 31 protected authService: AuthService,
bbe0f064 32 protected screenService: ScreenService,
93cae479
C
33 private videoService: VideoService,
34 private hooks: HooksService
989e526a 35 ) {
9bf9d2a5 36 super()
989e526a
C
37
38 this.titlePage = i18n('Recently added')
9bf9d2a5
C
39 }
40
41 ngOnInit () {
42 super.ngOnInit()
cc1561f9 43
244e76a5 44 this.generateSyndicationList()
9bf9d2a5
C
45 }
46
9af61e84
C
47 ngOnDestroy () {
48 super.ngOnDestroy()
49 }
50
0cd4344f
C
51 getVideosObservable (page: number) {
52 const newPagination = immutableAssign(this.pagination, { currentPage: page })
93cae479 53 const params = {
3caf77d3
C
54 videoPagination: newPagination,
55 sort: this.sort,
3caf77d3 56 categoryOneOf: this.categoryOneOf,
440d39c5
C
57 languageOneOf: this.languageOneOf,
58 skipCount: true
93cae479
C
59 }
60
61 return this.hooks.wrapObsFun(
62 this.videoService.getVideos.bind(this.videoService),
63 params,
64 'common',
7663e55a
C
65 'filter:api.recently-added-videos.videos.list.params',
66 'filter:api.recently-added-videos.videos.list.result'
93cae479 67 )
9bf9d2a5 68 }
244e76a5
RK
69
70 generateSyndicationList () {
d59cba29 71 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)
244e76a5 72 }
9bf9d2a5 73}