aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-02 15:47:04 +0100
committerChocobozzz <me@florianbigard.com>2022-03-02 15:47:04 +0100
commit77f811ced1cdf85c48dcdfeeceb90807bce0c851 (patch)
treeaeb8800d71cc7a67f8d5768e184df3874390cfa8
parent42d73f1c57f131e33d632de55d2b231f3fafd70c (diff)
downloadPeerTube-77f811ced1cdf85c48dcdfeeceb90807bce0c851.tar.gz
PeerTube-77f811ced1cdf85c48dcdfeeceb90807bce0c851.tar.zst
PeerTube-77f811ced1cdf85c48dcdfeeceb90807bce0c851.zip
Fix channel avatar in select component
-rw-r--r--client/src/app/helpers/utils/channel.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/client/src/app/helpers/utils/channel.ts b/client/src/app/helpers/utils/channel.ts
index 094a844e0..83f36b70f 100644
--- a/client/src/app/helpers/utils/channel.ts
+++ b/client/src/app/helpers/utils/channel.ts
@@ -1,6 +1,7 @@
1import { minBy } from 'lodash-es' 1import { minBy } from 'lodash-es'
2import { first, map } from 'rxjs/operators' 2import { first, map } from 'rxjs/operators'
3import { SelectChannelItem } from 'src/types/select-options-item.model' 3import { SelectChannelItem } from 'src/types/select-options-item.model'
4import { VideoChannel } from '@shared/models'
4import { AuthService } from '../../core/auth' 5import { AuthService } from '../../core/auth'
5 6
6function listUserChannelsForSelect (authService: AuthService) { 7function listUserChannelsForSelect (authService: AuthService) {
@@ -24,7 +25,7 @@ function listUserChannelsForSelect (authService: AuthService) {
24 id: c.id, 25 id: c.id,
25 label: c.displayName, 26 label: c.displayName,
26 support: c.support, 27 support: c.support,
27 avatarPath: minBy(c.avatars, 'width')?.[0]?.path 28 avatarPath: getAvatarPath(c)
28 }) as SelectChannelItem) 29 }) as SelectChannelItem)
29 }) 30 })
30 ) 31 )
@@ -33,3 +34,11 @@ function listUserChannelsForSelect (authService: AuthService) {
33export { 34export {
34 listUserChannelsForSelect 35 listUserChannelsForSelect
35} 36}
37
38// ---------------------------------------------------------------------------
39
40function getAvatarPath (c: VideoChannel) {
41 if (!c.avatars || c.avatars.length === 0) return undefined
42
43 return minBy(c.avatars, 'width').path
44}