diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-11 15:10:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-11 15:25:51 +0200 |
commit | 0f320037e689b2778959c12ddd4ce790f6e4ae4f (patch) | |
tree | 425acaa4345442388901c833275bb76b42a8a268 /client | |
parent | 9675333decd0b89b73a4fc67b39272f7296bfe3f (diff) | |
download | PeerTube-0f320037e689b2778959c12ddd4ce790f6e4ae4f.tar.gz PeerTube-0f320037e689b2778959c12ddd4ce790f6e4ae4f.tar.zst PeerTube-0f320037e689b2778959c12ddd4ce790f6e4ae4f.zip |
Add ability to update a video channel
Diffstat (limited to 'client')
9 files changed, 23 insertions, 20 deletions
diff --git a/client/src/app/shared/actor/actor.model.ts b/client/src/app/shared/actor/actor.model.ts index 56ff780b7..37d84cb6e 100644 --- a/client/src/app/shared/actor/actor.model.ts +++ b/client/src/app/shared/actor/actor.model.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Actor as ActorServer } from '../../../../../shared/models/actors/actor.model' | 1 | import { Actor as ActorServer } from '../../../../../shared/models/actors/actor.model' |
2 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' | ||
3 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' | 2 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' |
3 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' | ||
4 | 4 | ||
5 | export abstract class Actor implements ActorServer { | 5 | export abstract class Actor implements ActorServer { |
6 | id: number | 6 | id: number |
@@ -41,8 +41,8 @@ export abstract class Actor implements ActorServer { | |||
41 | this.host = hash.host | 41 | this.host = hash.host |
42 | this.followingCount = hash.followingCount | 42 | this.followingCount = hash.followingCount |
43 | this.followersCount = hash.followersCount | 43 | this.followersCount = hash.followersCount |
44 | this.createdAt = new Date(hash.createdAt.toString()) | 44 | this.createdAt = new Date(hash.createdAt) |
45 | this.updatedAt = new Date(hash.updatedAt.toString()) | 45 | this.updatedAt = new Date(hash.updatedAt) |
46 | this.avatar = hash.avatar | 46 | this.avatar = hash.avatar |
47 | 47 | ||
48 | this.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(this) | 48 | this.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(this) |
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts index 39826d71e..ad2929db5 100644 --- a/client/src/app/shared/video/video-edit.model.ts +++ b/client/src/app/shared/video/video-edit.model.ts | |||
@@ -10,7 +10,7 @@ export class VideoEdit { | |||
10 | tags: string[] | 10 | tags: string[] |
11 | nsfw: boolean | 11 | nsfw: boolean |
12 | commentsEnabled: boolean | 12 | commentsEnabled: boolean |
13 | channel: number | 13 | channelId: number |
14 | privacy: VideoPrivacy | 14 | privacy: VideoPrivacy |
15 | support: string | 15 | support: string |
16 | thumbnailfile?: any | 16 | thumbnailfile?: any |
@@ -32,7 +32,7 @@ export class VideoEdit { | |||
32 | this.tags = videoDetails.tags | 32 | this.tags = videoDetails.tags |
33 | this.nsfw = videoDetails.nsfw | 33 | this.nsfw = videoDetails.nsfw |
34 | this.commentsEnabled = videoDetails.commentsEnabled | 34 | this.commentsEnabled = videoDetails.commentsEnabled |
35 | this.channel = videoDetails.channel.id | 35 | this.channelId = videoDetails.channel.id |
36 | this.privacy = videoDetails.privacy.id | 36 | this.privacy = videoDetails.privacy.id |
37 | this.support = videoDetails.support | 37 | this.support = videoDetails.support |
38 | this.thumbnailUrl = videoDetails.thumbnailUrl | 38 | this.thumbnailUrl = videoDetails.thumbnailUrl |
@@ -57,7 +57,7 @@ export class VideoEdit { | |||
57 | tags: this.tags, | 57 | tags: this.tags, |
58 | nsfw: this.nsfw, | 58 | nsfw: this.nsfw, |
59 | commentsEnabled: this.commentsEnabled, | 59 | commentsEnabled: this.commentsEnabled, |
60 | channelId: this.channel, | 60 | channelId: this.channelId, |
61 | privacy: this.privacy | 61 | privacy: this.privacy |
62 | } | 62 | } |
63 | } | 63 | } |
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts index f56eecaeb..48d562f9c 100644 --- a/client/src/app/shared/video/video.model.ts +++ b/client/src/app/shared/video/video.model.ts | |||
@@ -45,6 +45,16 @@ export class Video implements VideoServerModel { | |||
45 | avatar: Avatar | 45 | avatar: Avatar |
46 | } | 46 | } |
47 | 47 | ||
48 | channel: { | ||
49 | id: number | ||
50 | uuid: string | ||
51 | name: string | ||
52 | displayName: string | ||
53 | url: string | ||
54 | host: string | ||
55 | avatar: Avatar | ||
56 | } | ||
57 | |||
48 | private static createDurationString (duration: number) { | 58 | private static createDurationString (duration: number) { |
49 | const hours = Math.floor(duration / 3600) | 59 | const hours = Math.floor(duration / 3600) |
50 | const minutes = Math.floor(duration % 3600 / 60) | 60 | const minutes = Math.floor(duration % 3600 / 60) |
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index b45777c55..cd8539b41 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -67,6 +67,7 @@ export class VideoService { | |||
67 | language, | 67 | language, |
68 | support, | 68 | support, |
69 | description, | 69 | description, |
70 | channelId: video.channelId, | ||
70 | privacy: video.privacy, | 71 | privacy: video.privacy, |
71 | tags: video.tags, | 72 | tags: video.tags, |
72 | nsfw: video.nsfw, | 73 | nsfw: video.nsfw, |
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.html b/client/src/app/videos/+video-edit/shared/video-edit.component.html index 9cd3454a0..77b554ad5 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.html | |||
@@ -33,7 +33,7 @@ | |||
33 | <div class="col-md-4"> | 33 | <div class="col-md-4"> |
34 | <div class="form-group"> | 34 | <div class="form-group"> |
35 | <label>Channel</label> | 35 | <label>Channel</label> |
36 | <div class="peertube-select-disabled-container"> | 36 | <div class="peertube-select-container"> |
37 | <select formControlName="channelId"> | 37 | <select formControlName="channelId"> |
38 | <option *ngFor="let channel of userVideoChannels" [value]="channel.id">{{ channel.label }}</option> | 38 | <option *ngFor="let channel of userVideoChannels" [value]="channel.id">{{ channel.label }}</option> |
39 | </select> | 39 | </select> |
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.scss b/client/src/app/videos/+video-edit/shared/video-edit.component.scss index cf64ff589..58ed5ab98 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.scss +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.scss | |||
@@ -5,10 +5,6 @@ | |||
5 | @include peertube-select-container(auto); | 5 | @include peertube-select-container(auto); |
6 | } | 6 | } |
7 | 7 | ||
8 | .peertube-select-disabled-container { | ||
9 | @include peertube-select-disabled-container(auto); | ||
10 | } | ||
11 | |||
12 | .form-group-checkbox { | 8 | .form-group-checkbox { |
13 | my-help { margin-left: 5px } | 9 | my-help { margin-left: 5px } |
14 | } | 10 | } |
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts index 6ab1a4a24..77e984855 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts | |||
@@ -75,7 +75,7 @@ export class VideoEditComponent implements OnInit { | |||
75 | 75 | ||
76 | this.form.addControl('name', new FormControl('', VIDEO_NAME.VALIDATORS)) | 76 | this.form.addControl('name', new FormControl('', VIDEO_NAME.VALIDATORS)) |
77 | this.form.addControl('privacy', new FormControl('', VIDEO_PRIVACY.VALIDATORS)) | 77 | this.form.addControl('privacy', new FormControl('', VIDEO_PRIVACY.VALIDATORS)) |
78 | this.form.addControl('channelId', new FormControl({ value: '', disabled: true })) | 78 | this.form.addControl('channelId', new FormControl('', VIDEO_CHANNEL.VALIDATORS)) |
79 | this.form.addControl('nsfw', new FormControl(false)) | 79 | this.form.addControl('nsfw', new FormControl(false)) |
80 | this.form.addControl('commentsEnabled', new FormControl(true)) | 80 | this.form.addControl('commentsEnabled', new FormControl(true)) |
81 | this.form.addControl('category', new FormControl('', VIDEO_CATEGORY.VALIDATORS)) | 81 | this.form.addControl('category', new FormControl('', VIDEO_CATEGORY.VALIDATORS)) |
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index ae5548897..fa967018d 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -220,7 +220,7 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy | |||
220 | 220 | ||
221 | const video = new VideoEdit() | 221 | const video = new VideoEdit() |
222 | video.patch(this.form.value) | 222 | video.patch(this.form.value) |
223 | video.channel = this.firstStepChannelId | 223 | video.channelId = this.firstStepChannelId |
224 | video.id = this.videoUploadedIds.id | 224 | video.id = this.videoUploadedIds.id |
225 | video.uuid = this.videoUploadedIds.uuid | 225 | video.uuid = this.videoUploadedIds.uuid |
226 | 226 | ||
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts index 6cd204f72..73e2764c6 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts | |||
@@ -9,9 +9,9 @@ import { ServerService } from '../../core' | |||
9 | import { AuthService } from '../../core/auth' | 9 | import { AuthService } from '../../core/auth' |
10 | import { FormReactive } from '../../shared' | 10 | import { FormReactive } from '../../shared' |
11 | import { ValidatorMessage } from '../../shared/forms/form-validators/validator-message' | 11 | import { ValidatorMessage } from '../../shared/forms/form-validators/validator-message' |
12 | import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' | ||
13 | import { VideoEdit } from '../../shared/video/video-edit.model' | 12 | import { VideoEdit } from '../../shared/video/video-edit.model' |
14 | import { VideoService } from '../../shared/video/video.service' | 13 | import { VideoService } from '../../shared/video/video.service' |
14 | import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | ||
15 | 15 | ||
16 | @Component({ | 16 | @Component({ |
17 | selector: 'my-videos-update', | 17 | selector: 'my-videos-update', |
@@ -64,12 +64,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
64 | video => { | 64 | video => { |
65 | this.video = new VideoEdit(video) | 65 | this.video = new VideoEdit(video) |
66 | 66 | ||
67 | this.userVideoChannels = [ | 67 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) |
68 | { | 68 | .catch(err => console.error(err)) |
69 | id: video.channel.id, | ||
70 | label: video.channel.displayName | ||
71 | } | ||
72 | ] | ||
73 | 69 | ||
74 | // We cannot set private a video that was not private | 70 | // We cannot set private a video that was not private |
75 | if (video.privacy.id !== VideoPrivacy.PRIVATE) { | 71 | if (video.privacy.id !== VideoPrivacy.PRIVATE) { |