aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/forms/form-validators/video-channel-validators.service.ts16
-rw-r--r--client/src/app/shared/video-channel/video-channel.model.ts2
-rw-r--r--client/src/app/shared/video-channel/video-channel.service.ts4
-rw-r--r--client/src/app/shared/video/video.service.ts2
4 files changed, 21 insertions, 3 deletions
diff --git a/client/src/app/shared/forms/form-validators/video-channel-validators.service.ts b/client/src/app/shared/forms/form-validators/video-channel-validators.service.ts
index 28b063f89..1ce3a0dca 100644
--- a/client/src/app/shared/forms/form-validators/video-channel-validators.service.ts
+++ b/client/src/app/shared/forms/form-validators/video-channel-validators.service.ts
@@ -5,11 +5,27 @@ import { BuildFormValidator } from '@app/shared'
5 5
6@Injectable() 6@Injectable()
7export class VideoChannelValidatorsService { 7export class VideoChannelValidatorsService {
8 readonly VIDEO_CHANNEL_NAME: BuildFormValidator
8 readonly VIDEO_CHANNEL_DISPLAY_NAME: BuildFormValidator 9 readonly VIDEO_CHANNEL_DISPLAY_NAME: BuildFormValidator
9 readonly VIDEO_CHANNEL_DESCRIPTION: BuildFormValidator 10 readonly VIDEO_CHANNEL_DESCRIPTION: BuildFormValidator
10 readonly VIDEO_CHANNEL_SUPPORT: BuildFormValidator 11 readonly VIDEO_CHANNEL_SUPPORT: BuildFormValidator
11 12
12 constructor (private i18n: I18n) { 13 constructor (private i18n: I18n) {
14 this.VIDEO_CHANNEL_NAME = {
15 VALIDATORS: [
16 Validators.required,
17 Validators.minLength(3),
18 Validators.maxLength(20),
19 Validators.pattern(/^[a-z0-9._]+$/)
20 ],
21 MESSAGES: {
22 'required': this.i18n('Name is required.'),
23 'minlength': this.i18n('Name must be at least 3 characters long.'),
24 'maxlength': this.i18n('Name cannot be more than 20 characters long.'),
25 'pattern': this.i18n('Name should be only lowercase alphanumeric characters.')
26 }
27 }
28
13 this.VIDEO_CHANNEL_DISPLAY_NAME = { 29 this.VIDEO_CHANNEL_DISPLAY_NAME = {
14 VALIDATORS: [ 30 VALIDATORS: [
15 Validators.required, 31 Validators.required,
diff --git a/client/src/app/shared/video-channel/video-channel.model.ts b/client/src/app/shared/video-channel/video-channel.model.ts
index b6862b681..309b614ae 100644
--- a/client/src/app/shared/video-channel/video-channel.model.ts
+++ b/client/src/app/shared/video-channel/video-channel.model.ts
@@ -7,6 +7,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel {
7 description: string 7 description: string
8 support: string 8 support: string
9 isLocal: boolean 9 isLocal: boolean
10 nameWithHost: string
10 ownerAccount?: Account 11 ownerAccount?: Account
11 ownerBy?: string 12 ownerBy?: string
12 ownerAvatarUrl?: string 13 ownerAvatarUrl?: string
@@ -18,6 +19,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel {
18 this.description = hash.description 19 this.description = hash.description
19 this.support = hash.support 20 this.support = hash.support
20 this.isLocal = hash.isLocal 21 this.isLocal = hash.isLocal
22 this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host)
21 23
22 if (hash.ownerAccount) { 24 if (hash.ownerAccount) {
23 this.ownerAccount = hash.ownerAccount 25 this.ownerAccount = hash.ownerAccount
diff --git a/client/src/app/shared/video-channel/video-channel.service.ts b/client/src/app/shared/video-channel/video-channel.service.ts
index 8c000665f..510dc9c3d 100644
--- a/client/src/app/shared/video-channel/video-channel.service.ts
+++ b/client/src/app/shared/video-channel/video-channel.service.ts
@@ -22,8 +22,8 @@ export class VideoChannelService {
22 private restExtractor: RestExtractor 22 private restExtractor: RestExtractor
23 ) {} 23 ) {}
24 24
25 getVideoChannel (videoChannelUUID: string) { 25 getVideoChannel (videoChannelName: string) {
26 return this.authHttp.get<VideoChannel>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelUUID) 26 return this.authHttp.get<VideoChannel>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName)
27 .pipe( 27 .pipe(
28 map(videoChannelHash => new VideoChannel(videoChannelHash)), 28 map(videoChannelHash => new VideoChannel(videoChannelHash)),
29 tap(videoChannel => this.videoChannelLoaded.next(videoChannel)), 29 tap(videoChannel => this.videoChannelLoaded.next(videoChannel)),
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index e2a62c701..e44f1ee65 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -150,7 +150,7 @@ export class VideoService {
150 params = this.restService.addRestGetParams(params, pagination, sort) 150 params = this.restService.addRestGetParams(params, pagination, sort)
151 151
152 return this.authHttp 152 return this.authHttp
153 .get<ResultList<Video>>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.uuid + '/videos', { params }) 153 .get<ResultList<Video>>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.name + '/videos', { params })
154 .pipe( 154 .pipe(
155 switchMap(res => this.extractVideos(res)), 155 switchMap(res => this.extractVideos(res)),
156 catchError(err => this.restExtractor.handleError(err)) 156 catchError(err => this.restExtractor.handleError(err))