aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-20 14:29:55 +0100
committerChocobozzz <me@florianbigard.com>2017-12-20 14:29:55 +0100
commit15a7387da888492068e2ce3d1e39639d142f6c6e (patch)
tree8eaec71d11c19a97dc99e4d9812dfc0c646dd9e7 /client/src/app/shared
parenta4b8a4ddccc926e0670d3687cccd52496f6f8a8f (diff)
downloadPeerTube-15a7387da888492068e2ce3d1e39639d142f6c6e.tar.gz
PeerTube-15a7387da888492068e2ce3d1e39639d142f6c6e.tar.zst
PeerTube-15a7387da888492068e2ce3d1e39639d142f6c6e.zip
Customize select
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/misc/utils.ts24
-rw-r--r--client/src/app/shared/video/video-edit.model.ts2
2 files changed, 24 insertions, 2 deletions
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index df9e0381a..5525e4efb 100644
--- a/client/src/app/shared/misc/utils.ts
+++ b/client/src/app/shared/misc/utils.ts
@@ -1,5 +1,7 @@
1// Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript 1// Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
2 2
3import { AuthService } from '../../core/auth'
4
3function getParameterByName (name: string, url: string) { 5function getParameterByName (name: string, url: string) {
4 if (!url) url = window.location.href 6 if (!url) url = window.location.href
5 name = name.replace(/[\[\]]/g, '\\$&') 7 name = name.replace(/[\[\]]/g, '\\$&')
@@ -17,7 +19,27 @@ function viewportHeight () {
17 return Math.max(document.documentElement.clientHeight, window.innerHeight || 0) 19 return Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
18} 20}
19 21
22function populateAsyncUserVideoChannels (authService: AuthService, channel: any[]) {
23 return new Promise(res => {
24 authService.userInformationLoaded
25 .subscribe(
26 () => {
27 const user = authService.getUser()
28 if (!user) return
29
30 const videoChannels = user.videoChannels
31 if (Array.isArray(videoChannels) === false) return
32
33 videoChannels.forEach(c => channel.push({ id: c.id, label: c.name }))
34
35 return res()
36 }
37 )
38 })
39}
40
20export { 41export {
21 viewportHeight, 42 viewportHeight,
22 getParameterByName 43 getParameterByName,
44 populateAsyncUserVideoChannels
23} 45}
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts
index 955255bfa..47c63d976 100644
--- a/client/src/app/shared/video/video-edit.model.ts
+++ b/client/src/app/shared/video/video-edit.model.ts
@@ -45,7 +45,7 @@ export class VideoEdit {
45 name: this.name, 45 name: this.name,
46 tags: this.tags, 46 tags: this.tags,
47 nsfw: this.nsfw, 47 nsfw: this.nsfw,
48 channel: this.channel, 48 channelId: this.channel,
49 privacy: this.privacy 49 privacy: this.privacy
50 } 50 }
51 } 51 }