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'
@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
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 userService: UserService,
private route: ActivatedRoute,
private screenService: ScreenService,
- private peertubeRouter: PeerTubeRouterService
+ private peertubeRouter: PeerTubeRouterService,
+ private serverService: ServerService
) {
}
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 = {
}
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
}
loadMoreVideos (reset = false) {
+ if (reset) this.hasDoneFirstQuery = false
+
this.getVideosObservableFunction(this.pagination, this.filters)
.subscribe({
next: ({ data }) => {