diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2022-03-08 13:39:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 13:39:27 +0100 |
commit | 2c102aac13ec537ff72ec09a50d3197ed3bc8185 (patch) | |
tree | 8224e2713866c17e54c927dc26f1a62a3353bc2e /client/src/app/shared | |
parent | fc10ecf167bd07f32426441e74b49370d5ff919b (diff) | |
download | PeerTube-2c102aac13ec537ff72ec09a50d3197ed3bc8185.tar.gz PeerTube-2c102aac13ec537ff72ec09a50d3197ed3bc8185.tar.zst PeerTube-2c102aac13ec537ff72ec09a50d3197ed3bc8185.zip |
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
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/videos-list.component.ts | 43 |
1 files changed, 31 insertions, 12 deletions
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' | |||
3 | import { debounceTime, switchMap } from 'rxjs/operators' | 3 | import { debounceTime, switchMap } from 'rxjs/operators' |
4 | import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core' | 4 | import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core' |
5 | import { ActivatedRoute } from '@angular/router' | 5 | import { ActivatedRoute } from '@angular/router' |
6 | import { AuthService, ComponentPaginationLight, Notifier, PeerTubeRouterService, ScreenService, User, UserService } from '@app/core' | 6 | import { |
7 | AuthService, | ||
8 | ComponentPaginationLight, | ||
9 | Notifier, | ||
10 | PeerTubeRouterService, | ||
11 | ScreenService, | ||
12 | ServerService, | ||
13 | User, | ||
14 | UserService | ||
15 | } from '@app/core' | ||
7 | import { GlobalIconName } from '@app/shared/shared-icons' | 16 | import { GlobalIconName } from '@app/shared/shared-icons' |
8 | import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils' | 17 | import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils' |
9 | import { ResultList, UserRight, VideoSortField } from '@shared/models' | 18 | import { ResultList, UserRight, VideoSortField } from '@shared/models' |
@@ -61,16 +70,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { | |||
61 | 70 | ||
62 | @Input() hideScopeFilter = false | 71 | @Input() hideScopeFilter = false |
63 | 72 | ||
64 | @Input() displayOptions: MiniatureDisplayOptions = { | 73 | @Input() displayOptions: MiniatureDisplayOptions |
65 | date: true, | ||
66 | views: true, | ||
67 | by: true, | ||
68 | avatar: false, | ||
69 | privacyLabel: true, | ||
70 | privacyText: false, | ||
71 | state: false, | ||
72 | blacklistInfo: false | ||
73 | } | ||
74 | 74 | ||
75 | @Input() disabled = false | 75 | @Input() disabled = false |
76 | 76 | ||
@@ -85,6 +85,16 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { | |||
85 | 85 | ||
86 | userMiniature: User | 86 | userMiniature: User |
87 | 87 | ||
88 | private defaultDisplayOptions: MiniatureDisplayOptions = { | ||
89 | date: true, | ||
90 | views: true, | ||
91 | by: true, | ||
92 | avatar: false, | ||
93 | privacyLabel: true, | ||
94 | privacyText: false, | ||
95 | state: false, | ||
96 | blacklistInfo: false | ||
97 | } | ||
88 | private routeSub: Subscription | 98 | private routeSub: Subscription |
89 | private userSub: Subscription | 99 | private userSub: Subscription |
90 | private resizeSub: Subscription | 100 | private resizeSub: Subscription |
@@ -105,7 +115,8 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { | |||
105 | private userService: UserService, | 115 | private userService: UserService, |
106 | private route: ActivatedRoute, | 116 | private route: ActivatedRoute, |
107 | private screenService: ScreenService, | 117 | private screenService: ScreenService, |
108 | private peertubeRouter: PeerTubeRouterService | 118 | private peertubeRouter: PeerTubeRouterService, |
119 | private serverService: ServerService | ||
109 | ) { | 120 | ) { |
110 | 121 | ||
111 | } | 122 | } |
@@ -161,6 +172,14 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { | |||
161 | } | 172 | } |
162 | 173 | ||
163 | ngOnChanges (changes: SimpleChanges) { | 174 | ngOnChanges (changes: SimpleChanges) { |
175 | if (changes['displayOptions'] || !this.displayOptions) { | ||
176 | this.displayOptions = { | ||
177 | ...this.defaultDisplayOptions, | ||
178 | avatar: this.serverService.getHTMLConfig().client.videos.miniature.displayAuthorAvatar, | ||
179 | ...changes['displayOptions'] | ||
180 | } | ||
181 | } | ||
182 | |||
164 | if (!this.filters) return | 183 | if (!this.filters) return |
165 | 184 | ||
166 | let updated = false | 185 | let updated = false |