]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-video-miniature/videos-list.component.ts
Registration css fixes
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-video-miniature / videos-list.component.ts
index 10de97298b4517a49354fedf0b26a8803f158a4b..38a80b97385d6323af01562724c9ed4d04fc6ad7 100644 (file)
@@ -3,7 +3,16 @@ import { fromEvent, Observable, Subject, Subscription } from 'rxjs'
 import { debounceTime, switchMap } from 'rxjs/operators'
 import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core'
 import { ActivatedRoute } from '@angular/router'
 import { debounceTime, switchMap } from 'rxjs/operators'
 import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core'
 import { ActivatedRoute } from '@angular/router'
-import { AuthService, ComponentPaginationLight, Notifier, PeerTubeRouterService, ScreenService, User, UserService } from '@app/core'
+import {
+  AuthService,
+  ComponentPaginationLight,
+  Notifier,
+  PeerTubeRouterService,
+  ScreenService,
+  ServerService,
+  User,
+  UserService
+} from '@app/core'
 import { GlobalIconName } from '@app/shared/shared-icons'
 import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils'
 import { ResultList, UserRight, VideoSortField } from '@shared/models'
 import { GlobalIconName } from '@app/shared/shared-icons'
 import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils'
 import { ResultList, UserRight, VideoSortField } from '@shared/models'
@@ -59,16 +68,9 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
 
   @Input() headerActions: HeaderAction[] = []
 
 
   @Input() headerActions: HeaderAction[] = []
 
-  @Input() displayOptions: MiniatureDisplayOptions = {
-    date: true,
-    views: true,
-    by: true,
-    avatar: false,
-    privacyLabel: true,
-    privacyText: false,
-    state: false,
-    blacklistInfo: false
-  }
+  @Input() hideScopeFilter = false
+
+  @Input() displayOptions: MiniatureDisplayOptions
 
   @Input() disabled = false
 
 
   @Input() disabled = false
 
@@ -83,6 +85,16 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
 
   userMiniature: User
 
 
   userMiniature: User
 
+  private defaultDisplayOptions: MiniatureDisplayOptions = {
+    date: true,
+    views: true,
+    by: true,
+    avatar: false,
+    privacyLabel: true,
+    privacyText: false,
+    state: false,
+    blacklistInfo: false
+  }
   private routeSub: Subscription
   private userSub: Subscription
   private resizeSub: Subscription
   private routeSub: Subscription
   private userSub: Subscription
   private resizeSub: Subscription
@@ -103,13 +115,18 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
     private userService: UserService,
     private route: ActivatedRoute,
     private screenService: ScreenService,
     private userService: UserService,
     private route: ActivatedRoute,
     private screenService: ScreenService,
-    private peertubeRouter: PeerTubeRouterService
+    private peertubeRouter: PeerTubeRouterService,
+    private serverService: ServerService
   ) {
 
   }
 
   ngOnInit () {
   ) {
 
   }
 
   ngOnInit () {
-    this.filters = new VideoFilters(this.defaultSort, this.defaultScope)
+    const hiddenFilters = this.hideScopeFilter
+      ? [ 'scope' ]
+      : []
+
+    this.filters = new VideoFilters(this.defaultSort, this.defaultScope, hiddenFilters)
     this.filters.load({ ...this.route.snapshot.queryParams, scope: this.defaultScope })
 
     this.groupedDateLabels = {
     this.filters.load({ ...this.route.snapshot.queryParams, scope: this.defaultScope })
 
     this.groupedDateLabels = {
@@ -155,6 +172,14 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
   }
 
   ngOnChanges (changes: SimpleChanges) {
   }
 
   ngOnChanges (changes: SimpleChanges) {
+    if (changes['displayOptions'] || !this.displayOptions) {
+      this.displayOptions = {
+        ...this.defaultDisplayOptions,
+        avatar: this.serverService.getHTMLConfig().client.videos.miniature.displayAuthorAvatar,
+        ...changes['displayOptions']
+      }
+    }
+
     if (!this.filters) return
 
     let updated = false
     if (!this.filters) return
 
     let updated = false
@@ -201,6 +226,8 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
   }
 
   loadMoreVideos (reset = false) {
   }
 
   loadMoreVideos (reset = false) {
+    if (reset) this.hasDoneFirstQuery = false
+
     this.getVideosObservableFunction(this.pagination, this.filters)
       .subscribe({
         next: ({ data }) => {
     this.getVideosObservableFunction(this.pagination, this.filters)
       .subscribe({
         next: ({ data }) => {