aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-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}