From 47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Jan 2018 10:12:36 +0100 Subject: Add ability to disable video comments --- .../+video-edit/shared/video-edit.component.html | 6 +++ .../+video-edit/shared/video-edit.component.ts | 1 + .../app/videos/+video-edit/video-add.component.ts | 2 + .../comment/video-comments.component.html | 58 ++++++++++++---------- .../comment/video-comments.component.ts | 7 ++- 5 files changed, 47 insertions(+), 27 deletions(-) (limited to 'client/src/app/videos') 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 9acbafcb6..80377933e 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 @@ -99,5 +99,11 @@ +
+ + + +
+ 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 7fe265284..2b307d5fa 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 @@ -70,6 +70,7 @@ export class VideoEditComponent implements OnInit { this.form.addControl('privacy', new FormControl('', VIDEO_PRIVACY.VALIDATORS)) this.form.addControl('channelId', new FormControl({ value: '', disabled: true })) this.form.addControl('nsfw', new FormControl(false)) + this.form.addControl('commentsEnabled', new FormControl(true)) this.form.addControl('category', new FormControl('', VIDEO_CATEGORY.VALIDATORS)) this.form.addControl('licence', new FormControl('', VIDEO_LICENCE.VALIDATORS)) this.form.addControl('language', new FormControl('', VIDEO_LANGUAGE.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 9bbee58d8..843475647 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts @@ -88,6 +88,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { const name = videofile.name.replace(/\.[^/.]+$/, '') const privacy = this.firstStepPrivacyId.toString() const nsfw = false + const commentsEnabled = true const channelId = this.firstStepChannelId.toString() const formData = new FormData() @@ -95,6 +96,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { // Put the video "private" -> we wait he validates the second step formData.append('privacy', VideoPrivacy.PRIVATE.toString()) formData.append('nsfw', '' + nsfw) + formData.append('commentsEnabled', '' + commentsEnabled) formData.append('channelId', '' + channelId) formData.append('videofile', videofile) diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html index 5c6908150..078900e06 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html @@ -3,35 +3,43 @@ Comments - + + -
-
- +
No comments.
-
- View all {{ comment.totalReplies }} replies +
+
+ - - +
+ View all {{ comment.totalReplies }} replies + + + +
+ + +
+ Comments are disabled.
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts index f4dda9089..4d801c970 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts @@ -5,6 +5,7 @@ import { AuthService } from '../../../core/auth' import { ComponentPagination } from '../../../shared/rest/component-pagination.model' import { User } from '../../../shared/users' import { SortField } from '../../../shared/video/sort-field.type' +import { VideoDetails } from '../../../shared/video/video-details.model' import { Video } from '../../../shared/video/video.model' import { VideoComment } from './video-comment.model' import { VideoCommentService } from './video-comment.service' @@ -15,7 +16,7 @@ import { VideoCommentService } from './video-comment.service' styleUrls: ['./video-comments.component.scss'] }) export class VideoCommentsComponent implements OnInit { - @Input() video: Video + @Input() video: VideoDetails @Input() user: User comments: VideoComment[] = [] @@ -36,7 +37,9 @@ export class VideoCommentsComponent implements OnInit { ) {} ngOnInit () { - this.loadMoreComments() + if (this.video.commentsEnabled === true) { + this.loadMoreComments() + } } viewReplies (comment: VideoComment) { -- cgit v1.2.3