async function videoActivityObjectToDBAttributes (videoChannel: VideoChannelModel,
videoObject: VideoTorrentObject,
- to: string[] = [],
- cc: string[] = []) {
- let privacy = VideoPrivacy.PRIVATE
- if (to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1) privacy = VideoPrivacy.PUBLIC
- else if (cc.indexOf(ACTIVITY_PUB.PUBLIC) !== -1) privacy = VideoPrivacy.UNLISTED
+ to: string[] = []) {
+ const privacy = to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1 ? VideoPrivacy.PUBLIC : VideoPrivacy.UNLISTED
const duration = videoObject.duration.replace(/[^\d]+/, '')
let language = null
licence = parseInt(videoObject.licence.identifier, 10)
}
- let description = null
- if (videoObject.content) {
- description = videoObject.content
- }
+ const description = videoObject.content || null
+ const support = videoObject.support || null
return {
name: videoObject.name,
licence,
language,
description,
+ support,
nsfw: videoObject.sensitive,
commentsEnabled: videoObject.commentsEnabled,
channelId: videoChannel.id,
const videoFromDatabase = await VideoModel.loadByUUIDOrURLAndPopulateAccount(videoObject.uuid, videoObject.id, t)
if (videoFromDatabase) return videoFromDatabase
- const videoData = await videoActivityObjectToDBAttributes(channelActor.VideoChannel, videoObject, videoObject.to, videoObject.cc)
+ const videoData = await videoActivityObjectToDBAttributes(channelActor.VideoChannel, videoObject, videoObject.to)
const video = VideoModel.build(videoData)
// Don't block on request
const entry = {
actorId: actor.id,
- videoId: instance.id
+ videoId: instance.id,
+ url: shareUrl
}
await VideoShareModel.findOrCreate({
- where: entry,
+ where: {
+ url: shareUrl
+ },
defaults: entry
})
}