diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video.ts | 11 |
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' | |||
15 | import { activityPubCollection } from '../../helpers/activitypub' | 15 | import { activityPubCollection } from '../../helpers/activitypub' |
16 | import { createTorrentPromise, renamePromise, statPromise, unlinkPromise, writeFilePromise } from '../../helpers/core-utils' | 16 | import { createTorrentPromise, renamePromise, statPromise, unlinkPromise, writeFilePromise } from '../../helpers/core-utils' |
17 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' | 17 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' |
18 | import { isBooleanValid } from '../../helpers/custom-validators/misc' | ||
18 | import { | 19 | import { |
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' |
22 | import { generateImageFromVideoFile, getVideoFileHeight, transcode } from '../../helpers/ffmpeg-utils' | 23 | import { generateImageFromVideoFile, getVideoFileHeight, transcode } from '../../helpers/ffmpeg-utils' |
23 | import { logger } from '../../helpers/logger' | 24 | import { 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', |