]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-user-subscriptions.component.ts
Skip videos count on client if we don't use it
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-user-subscriptions.component.ts
CommitLineData
22a16e36
C
1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
22a16e36
C
4import { AuthService } from '../../core/auth'
5import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6import { VideoSortField } from '../../shared/video/sort-field.type'
7import { VideoService } from '../../shared/video/video.service'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { ScreenService } from '@app/shared/misc/screen.service'
10import { OwnerDisplayType } from '@app/shared/video/video-miniature.component'
489290b8 11import { Notifier, ServerService } from '@app/core'
93cae479 12import { HooksService } from '@app/core/plugins/hooks.service'
22a16e36
C
13
14@Component({
15 selector: 'my-videos-user-subscriptions',
16 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
17 templateUrl: '../../shared/video/abstract-video-list.html'
18})
19export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy {
20 titlePage: string
22a16e36
C
21 sort = '-publishedAt' as VideoSortField
22 ownerDisplayType: OwnerDisplayType = 'auto'
34c7f429 23 groupByDate = true
22a16e36
C
24
25 constructor (
34c7f429 26 protected i18n: I18n,
22a16e36 27 protected router: Router,
489290b8 28 protected serverService: ServerService,
22a16e36 29 protected route: ActivatedRoute,
f8b2c1b4 30 protected notifier: Notifier,
22a16e36 31 protected authService: AuthService,
22a16e36 32 protected screenService: ScreenService,
93cae479
C
33 private videoService: VideoService,
34 private hooks: HooksService
22a16e36
C
35 ) {
36 super()
37
38 this.titlePage = i18n('Videos from your subscriptions')
13adf228
RK
39 this.actions.push({
40 routerLink: '/my-account/subscriptions',
41 label: i18n('Subscriptions'),
42 iconName: 'cog'
43 })
22a16e36
C
44 }
45
46 ngOnInit () {
47 super.ngOnInit()
48 }
49
50 ngOnDestroy () {
51 super.ngOnDestroy()
52 }
53
54 getVideosObservable (page: number) {
55 const newPagination = immutableAssign(this.pagination, { currentPage: page })
93cae479
C
56 const params = {
57 videoPagination: newPagination,
440d39c5
C
58 sort: this.sort,
59 skipCount: true
93cae479 60 }
22a16e36 61
93cae479
C
62 return this.hooks.wrapObsFun(
63 this.videoService.getUserSubscriptionVideos.bind(this.videoService),
64 params,
65 'common',
7663e55a
C
66 'filter:api.user-subscriptions-videos.videos.list.params',
67 'filter:api.user-subscriptions-videos.videos.list.result'
93cae479 68 )
22a16e36
C
69 }
70
71 generateSyndicationList () {
72 // not implemented yet
73 }
74}