]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - 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
index f99c8abb648b820ac9c756ba7559b54a000a8559..7568f4536df21d933acd246aefcb9112f8f4159b 100644 (file)
@@ -1,6 +1,5 @@
 import { Component, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
-import { Location } from '@angular/common'
 import { immutableAssign } from '@app/shared/misc/utils'
 import { AuthService } from '../../core/auth'
 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
@@ -8,7 +7,8 @@ import { VideoSortField } from '../../shared/video/sort-field.type'
 import { VideoService } from '../../shared/video/video.service'
 import { I18n } from '@ngx-translate/i18n-polyfill'
 import { ScreenService } from '@app/shared/misc/screen.service'
-import { Notifier } from '@app/core'
+import { Notifier, ServerService } from '@app/core'
+import { HooksService } from '@app/core/plugins/hooks.service'
 
 @Component({
   selector: 'my-videos-recently-added',
@@ -17,18 +17,21 @@ import { Notifier } from '@app/core'
 })
 export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
   titlePage: string
-  currentRoute = '/videos/recently-added'
   sort: VideoSortField = '-publishedAt'
+  groupByDate = true
+
+  useUserVideoLanguagePreferences = true
 
   constructor (
-    protected router: Router,
+    protected i18n: I18n,
     protected route: ActivatedRoute,
-    protected location: Location,
+    protected serverService: ServerService,
+    protected router: Router,
     protected notifier: Notifier,
     protected authService: AuthService,
-    protected i18n: I18n,
     protected screenService: ScreenService,
-    private videoService: VideoService
+    private videoService: VideoService,
+    private hooks: HooksService
   ) {
     super()
 
@@ -47,8 +50,21 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
 
   getVideosObservable (page: number) {
     const newPagination = immutableAssign(this.pagination, { currentPage: page })
+    const params = {
+      videoPagination: newPagination,
+      sort: this.sort,
+      categoryOneOf: this.categoryOneOf,
+      languageOneOf: this.languageOneOf,
+      skipCount: true
+    }
 
-    return this.videoService.getVideos(newPagination, this.sort, undefined, this.categoryOneOf)
+    return this.hooks.wrapObsFun(
+      this.videoService.getVideos.bind(this.videoService),
+      params,
+      'common',
+      'filter:api.recently-added-videos.videos.list.params',
+      'filter:api.recently-added-videos.videos.list.result'
+    )
   }
 
   generateSyndicationList () {