aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-03 10:12:36 +0100
committerChocobozzz <me@florianbigard.com>2018-01-03 10:38:19 +0100
commit47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04 (patch)
tree25e2836baf3dfce6f422192d98332db1bfe65890 /server/models/video
parentc5911fd347c76e8bdc05ea9f3ee9efed4a58c236 (diff)
downloadPeerTube-47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04.tar.gz
PeerTube-47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04.tar.zst
PeerTube-47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04.zip
Add ability to disable video comments
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 2504ae58a..c4b716cd2 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -15,9 +15,10 @@ import { Video, VideoDetails } from '../../../shared/models/videos'
15import { activityPubCollection } from '../../helpers/activitypub' 15import { activityPubCollection } from '../../helpers/activitypub'
16import { createTorrentPromise, renamePromise, statPromise, unlinkPromise, writeFilePromise } from '../../helpers/core-utils' 16import { createTorrentPromise, renamePromise, statPromise, unlinkPromise, writeFilePromise } from '../../helpers/core-utils'
17import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 17import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
18import { isBooleanValid } from '../../helpers/custom-validators/misc'
18import { 19import {
19 isVideoCategoryValid, isVideoDescriptionValid, isVideoDurationValid, isVideoLanguageValid, isVideoLicenceValid, isVideoNameValid, 20 isVideoCategoryValid, isVideoDescriptionValid, isVideoDurationValid, isVideoLanguageValid, isVideoLicenceValid, isVideoNameValid,
20 isVideoNSFWValid, isVideoPrivacyValid 21 isVideoPrivacyValid
21} from '../../helpers/custom-validators/videos' 22} from '../../helpers/custom-validators/videos'
22import { generateImageFromVideoFile, getVideoFileHeight, transcode } from '../../helpers/ffmpeg-utils' 23import { generateImageFromVideoFile, getVideoFileHeight, transcode } from '../../helpers/ffmpeg-utils'
23import { logger } from '../../helpers/logger' 24import { logger } from '../../helpers/logger'
@@ -185,7 +186,7 @@ export class VideoModel extends Model<VideoModel> {
185 privacy: number 186 privacy: number
186 187
187 @AllowNull(false) 188 @AllowNull(false)
188 @Is('VideoNSFW', value => throwIfNotValid(value, isVideoNSFWValid, 'NSFW boolean')) 189 @Is('VideoNSFW', value => throwIfNotValid(value, isBooleanValid, 'NSFW boolean'))
189 @Column 190 @Column
190 nsfw: boolean 191 nsfw: boolean
191 192
@@ -230,6 +231,10 @@ export class VideoModel extends Model<VideoModel> {
230 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max)) 231 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))
231 url: string 232 url: string
232 233
234 @AllowNull(false)
235 @Column
236 commentsEnabled: boolean
237
233 @CreatedAt 238 @CreatedAt
234 createdAt: Date 239 createdAt: Date
235 240
@@ -773,6 +778,7 @@ export class VideoModel extends Model<VideoModel> {
773 channel: this.VideoChannel.toFormattedJSON(), 778 channel: this.VideoChannel.toFormattedJSON(),
774 account: this.VideoChannel.Account.toFormattedJSON(), 779 account: this.VideoChannel.Account.toFormattedJSON(),
775 tags: map<TagModel, string>(this.Tags, 'name'), 780 tags: map<TagModel, string>(this.Tags, 'name'),
781 commentsEnabled: this.commentsEnabled,
776 files: [] 782 files: []
777 } 783 }
778 784
@@ -920,6 +926,7 @@ export class VideoModel extends Model<VideoModel> {
920 language, 926 language,
921 views: this.views, 927 views: this.views,
922 nsfw: this.nsfw, 928 nsfw: this.nsfw,
929 commentsEnabled: this.commentsEnabled,
923 published: this.createdAt.toISOString(), 930 published: this.createdAt.toISOString(),
924 updated: this.updatedAt.toISOString(), 931 updated: this.updatedAt.toISOString(),
925 mediaType: 'text/markdown', 932 mediaType: 'text/markdown',