aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2022-03-08 13:39:27 +0100
committerGitHub <noreply@github.com>2022-03-08 13:39:27 +0100
commit2c102aac13ec537ff72ec09a50d3197ed3bc8185 (patch)
tree8224e2713866c17e54c927dc26f1a62a3353bc2e
parentfc10ecf167bd07f32426441e74b49370d5ff919b (diff)
downloadPeerTube-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
-rw-r--r--client/src/app/shared/shared-video-miniature/videos-list.component.ts43
-rw-r--r--config/default.yaml1
-rw-r--r--config/production.yaml.example1
-rw-r--r--server/initializers/checker-before-init.ts1
-rw-r--r--server/initializers/config.ts3
-rw-r--r--server/lib/server-config-manager.ts1
-rw-r--r--shared/models/server/server-config.model.ts1
7 files changed, 38 insertions, 13 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'
3import { debounceTime, switchMap } from 'rxjs/operators' 3import { debounceTime, switchMap } from 'rxjs/operators'
4import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core' 4import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core'
5import { ActivatedRoute } from '@angular/router' 5import { ActivatedRoute } from '@angular/router'
6import { AuthService, ComponentPaginationLight, Notifier, PeerTubeRouterService, ScreenService, User, UserService } from '@app/core' 6import {
7 AuthService,
8 ComponentPaginationLight,
9 Notifier,
10 PeerTubeRouterService,
11 ScreenService,
12 ServerService,
13 User,
14 UserService
15} from '@app/core'
7import { GlobalIconName } from '@app/shared/shared-icons' 16import { GlobalIconName } from '@app/shared/shared-icons'
8import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils' 17import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils'
9import { ResultList, UserRight, VideoSortField } from '@shared/models' 18import { 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
diff --git a/config/default.yaml b/config/default.yaml
index 3588a5ec9..d76894b52 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -624,6 +624,7 @@ client:
624 miniature: 624 miniature:
625 # By default PeerTube client displays author username 625 # By default PeerTube client displays author username
626 prefer_author_display_name: false 626 prefer_author_display_name: false
627 display_author_avatar: false
627 628
628 menu: 629 menu:
629 login: 630 login:
diff --git a/config/production.yaml.example b/config/production.yaml.example
index 73d1ead66..45d26190a 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -632,6 +632,7 @@ client:
632 miniature: 632 miniature:
633 # By default PeerTube client displays author username 633 # By default PeerTube client displays author username
634 prefer_author_display_name: false 634 prefer_author_display_name: false
635 display_author_avatar: false
635 636
636 menu: 637 menu:
637 login: 638 login:
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts
index 36401f95c..10dd98f43 100644
--- a/server/initializers/checker-before-init.ts
+++ b/server/initializers/checker-before-init.ts
@@ -33,6 +33,7 @@ function checkMissedConfig () {
33 'transcoding.resolutions.2160p', 'video_editor.enabled', 33 'transcoding.resolutions.2160p', 'video_editor.enabled',
34 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'auto_blacklist.videos.of_users.enabled', 34 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'auto_blacklist.videos.of_users.enabled',
35 'trending.videos.interval_days', 35 'trending.videos.interval_days',
36 'client.videos.miniature.display_author_avatar',
36 'client.videos.miniature.prefer_author_display_name', 'client.menu.login.redirect_on_single_external_auth', 37 'client.videos.miniature.prefer_author_display_name', 'client.menu.login.redirect_on_single_external_auth',
37 'defaults.publish.download_enabled', 'defaults.publish.comments_enabled', 'defaults.publish.privacy', 'defaults.publish.licence', 38 'defaults.publish.download_enabled', 'defaults.publish.comments_enabled', 'defaults.publish.privacy', 'defaults.publish.licence',
38 'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route', 39 'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route',
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 63056b41d..7a13a1368 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -62,7 +62,8 @@ const CONFIG = {
62 CLIENT: { 62 CLIENT: {
63 VIDEOS: { 63 VIDEOS: {
64 MINIATURE: { 64 MINIATURE: {
65 get PREFER_AUTHOR_DISPLAY_NAME () { return config.get<boolean>('client.videos.miniature.prefer_author_display_name') } 65 get PREFER_AUTHOR_DISPLAY_NAME () { return config.get<boolean>('client.videos.miniature.prefer_author_display_name') },
66 get DISPLAY_AUTHOR_AVATAR () { return config.get<boolean>('client.videos.miniature.display_author_avatar') }
66 } 67 }
67 }, 68 },
68 MENU: { 69 MENU: {
diff --git a/server/lib/server-config-manager.ts b/server/lib/server-config-manager.ts
index 38512f384..43ca2332b 100644
--- a/server/lib/server-config-manager.ts
+++ b/server/lib/server-config-manager.ts
@@ -46,6 +46,7 @@ class ServerConfigManager {
46 client: { 46 client: {
47 videos: { 47 videos: {
48 miniature: { 48 miniature: {
49 displayAuthorAvatar: CONFIG.CLIENT.VIDEOS.MINIATURE.DISPLAY_AUTHOR_AVATAR,
49 preferAuthorDisplayName: CONFIG.CLIENT.VIDEOS.MINIATURE.PREFER_AUTHOR_DISPLAY_NAME 50 preferAuthorDisplayName: CONFIG.CLIENT.VIDEOS.MINIATURE.PREFER_AUTHOR_DISPLAY_NAME
50 } 51 }
51 }, 52 },
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index 0fe8b0de8..b06019bb8 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -38,6 +38,7 @@ export interface ServerConfig {
38 client: { 38 client: {
39 videos: { 39 videos: {
40 miniature: { 40 miniature: {
41 displayAuthorAvatar: boolean
41 preferAuthorDisplayName: boolean 42 preferAuthorDisplayName: boolean
42 } 43 }
43 } 44 }