Fix lint
[oweals/peertube.git] / server / lib / activitypub / videos.ts
index e65362190cb481814a936070b853af34c3aab7f1..e7b516129aa4a87b4d14db81acb155fe5aa1ad6f 100644 (file)
@@ -56,11 +56,8 @@ function generateThumbnailFromUrl (video: VideoModel, icon: ActivityIconObject)
 
 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
@@ -78,15 +75,8 @@ async function videoActivityObjectToDBAttributes (videoChannel: VideoChannelMode
     licence = parseInt(videoObject.licence.identifier, 10)
   }
 
-  let description = null
-  if (videoObject.content) {
-    description = videoObject.content
-  }
-
-  let support = null
-  if (videoObject.support) {
-    support = videoObject.support
-  }
+  const description = videoObject.content || null
+  const support = videoObject.support || null
 
   return {
     name: videoObject.name,
@@ -157,7 +147,7 @@ async function getOrCreateVideo (videoObject: VideoTorrentObject, channelActor:
     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