aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/helpers/utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-10 09:31:33 +0200
committerChocobozzz <me@florianbigard.com>2021-05-10 09:38:11 +0200
commitdc2b2938c293bae271a27a6c823f66496998b4d3 (patch)
tree5952837923f46f31684dfee68688091eb112938d /client/src/app/helpers/utils.ts
parente024fd6a7494b37251da1d59470324305cdb4129 (diff)
downloadPeerTube-dc2b2938c293bae271a27a6c823f66496998b4d3.tar.gz
PeerTube-dc2b2938c293bae271a27a6c823f66496998b4d3.tar.zst
PeerTube-dc2b2938c293bae271a27a6c823f66496998b4d3.zip
Sort channels by -updatedAt
Diffstat (limited to 'client/src/app/helpers/utils.ts')
-rw-r--r--client/src/app/helpers/utils.ts18
1 files changed, 12 insertions, 6 deletions
diff --git a/client/src/app/helpers/utils.ts b/client/src/app/helpers/utils.ts
index a1747af3c..17eb5effc 100644
--- a/client/src/app/helpers/utils.ts
+++ b/client/src/app/helpers/utils.ts
@@ -30,12 +30,18 @@ function listUserChannels (authService: AuthService) {
30 const videoChannels = user.videoChannels 30 const videoChannels = user.videoChannels
31 if (Array.isArray(videoChannels) === false) return undefined 31 if (Array.isArray(videoChannels) === false) return undefined
32 32
33 return videoChannels.map(c => ({ 33 return videoChannels
34 id: c.id, 34 .sort((a, b) => {
35 label: c.displayName, 35 if (a.updatedAt < b.updatedAt) return 1
36 support: c.support, 36 if (a.updatedAt > b.updatedAt) return -1
37 avatarPath: c.avatar?.path 37 return 0
38 }) as SelectChannelItem) 38 })
39 .map(c => ({
40 id: c.id,
41 label: c.displayName,
42 support: c.support,
43 avatarPath: c.avatar?.path
44 }) as SelectChannelItem)
39 })) 45 }))
40} 46}
41 47