diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/app/helpers/utils/channel.ts | 11 |
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 @@ | |||
1 | import { minBy } from 'lodash-es' | 1 | import { minBy } from 'lodash-es' |
2 | import { first, map } from 'rxjs/operators' | 2 | import { first, map } from 'rxjs/operators' |
3 | import { SelectChannelItem } from 'src/types/select-options-item.model' | 3 | import { SelectChannelItem } from 'src/types/select-options-item.model' |
4 | import { VideoChannel } from '@shared/models' | ||
4 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
5 | 6 | ||
6 | function listUserChannelsForSelect (authService: AuthService) { | 7 | function 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) { | |||
33 | export { | 34 | export { |
34 | listUserChannelsForSelect | 35 | listUserChannelsForSelect |
35 | } | 36 | } |
37 | |||
38 | // --------------------------------------------------------------------------- | ||
39 | |||
40 | function getAvatarPath (c: VideoChannel) { | ||
41 | if (!c.avatars || c.avatars.length === 0) return undefined | ||
42 | |||
43 | return minBy(c.avatars, 'width').path | ||
44 | } | ||