aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/helpers/utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-10 15:48:10 +0200
committerChocobozzz <me@florianbigard.com>2021-05-10 15:48:10 +0200
commit1fa23d6f5e487f3c149e1f0001beadd919ee82fc (patch)
treed71e921808098308964794dcb4738c4f03a4bfe8 /client/src/app/helpers/utils.ts
parentff0497fee85db13e81c90224d75e491faea0d0e3 (diff)
downloadPeerTube-1fa23d6f5e487f3c149e1f0001beadd919ee82fc.tar.gz
PeerTube-1fa23d6f5e487f3c149e1f0001beadd919ee82fc.tar.zst
PeerTube-1fa23d6f5e487f3c149e1f0001beadd919ee82fc.zip
Fix video update
Diffstat (limited to 'client/src/app/helpers/utils.ts')
-rw-r--r--client/src/app/helpers/utils.ts45
1 files changed, 24 insertions, 21 deletions
diff --git a/client/src/app/helpers/utils.ts b/client/src/app/helpers/utils.ts
index d6ac5b9b4..94f6def26 100644
--- a/client/src/app/helpers/utils.ts
+++ b/client/src/app/helpers/utils.ts
@@ -1,4 +1,4 @@
1import { map } from 'rxjs/operators' 1import { first, map } from 'rxjs/operators'
2import { SelectChannelItem } from 'src/types/select-options-item.model' 2import { SelectChannelItem } from 'src/types/select-options-item.model'
3import { DatePipe } from '@angular/common' 3import { DatePipe } from '@angular/common'
4import { HttpErrorResponse } from '@angular/common/http' 4import { HttpErrorResponse } from '@angular/common/http'
@@ -23,26 +23,29 @@ function getParameterByName (name: string, url: string) {
23 23
24function listUserChannels (authService: AuthService) { 24function listUserChannels (authService: AuthService) {
25 return authService.userInformationLoaded 25 return authService.userInformationLoaded
26 .pipe(map(() => { 26 .pipe(
27 const user = authService.getUser() 27 first(),
28 if (!user) return undefined 28 map(() => {
29 29 const user = authService.getUser()
30 const videoChannels = user.videoChannels 30 if (!user) return undefined
31 if (Array.isArray(videoChannels) === false) return undefined 31
32 32 const videoChannels = user.videoChannels
33 return videoChannels 33 if (Array.isArray(videoChannels) === false) return undefined
34 .sort((a, b) => { 34
35 if (a.updatedAt < b.updatedAt) return 1 35 return videoChannels
36 if (a.updatedAt > b.updatedAt) return -1 36 .sort((a, b) => {
37 return 0 37 if (a.updatedAt < b.updatedAt) return 1
38 }) 38 if (a.updatedAt > b.updatedAt) return -1
39 .map(c => ({ 39 return 0
40 id: c.id, 40 })
41 label: c.displayName, 41 .map(c => ({
42 support: c.support, 42 id: c.id,
43 avatarPath: c.avatar?.path 43 label: c.displayName,
44 }) as SelectChannelItem) 44 support: c.support,
45 })) 45 avatarPath: c.avatar?.path
46 }) as SelectChannelItem)
47 })
48 )
46} 49}
47 50
48function getAbsoluteAPIUrl () { 51function getAbsoluteAPIUrl () {