From 2c102aac13ec537ff72ec09a50d3197ed3bc8185 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Tue, 8 Mar 2022 13:39:27 +0100 Subject: Display avatar in video miniatures (#4823) * show avatar in video miniatures closes #4040 * fix: videos for api, include avatars * add config for display video miniature avatar * Revert "fix: videos for api, include avatars" This reverts commit 5520a3eda6805338317a394d0553f2f82095a425. * video-min: set display avatar to false as default * remove empty line * rename display_avatar > display_author_avatar * fix renaming displayAvatar > displayAuthorAvatar --- .../videos-list.component.ts | 43 ++++++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.ts b/client/src/app/shared/shared-video-miniature/videos-list.component.ts index 9a7ec7efa..38a80b973 100644 --- a/client/src/app/shared/shared-video-miniature/videos-list.component.ts +++ b/client/src/app/shared/shared-video-miniature/videos-list.component.ts @@ -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 { 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' @@ -61,16 +70,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { @Input() hideScopeFilter = false - @Input() displayOptions: MiniatureDisplayOptions = { - date: true, - views: true, - by: true, - avatar: false, - privacyLabel: true, - privacyText: false, - state: false, - blacklistInfo: false - } + @Input() displayOptions: MiniatureDisplayOptions @Input() disabled = false @@ -85,6 +85,16 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { 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 @@ -105,7 +115,8 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { private userService: UserService, private route: ActivatedRoute, private screenService: ScreenService, - private peertubeRouter: PeerTubeRouterService + private peertubeRouter: PeerTubeRouterService, + private serverService: ServerService ) { } @@ -161,6 +172,14 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { } 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 -- cgit v1.2.3