Refractor activity pub lib/helpers
[oweals/peertube.git] / server / lib / video-channel.ts
index e69ec062f2ad7bd442de775826570991f51f78d2..5235d9cb56d2c56036a971e60c3d99ca5ae95124 100644 (file)
@@ -1,11 +1,9 @@
 import * as Sequelize from 'sequelize'
-
-import { database as db } from '../initializers'
+import { VideoChannelCreate } from '../../shared/models'
 import { logger } from '../helpers'
+import { database as db } from '../initializers'
 import { AccountInstance } from '../models'
-import { VideoChannelCreate } from '../../shared/models'
-import { sendCreateVideoChannel } from './activitypub/send-request'
-import { getActivityPubUrl, shareVideoChannelByServer } from '../helpers/activitypub'
+import { getVideoChannelActivityPubUrl } from '../helpers/activitypub'
 
 async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account: AccountInstance, t: Sequelize.Transaction) {
   const videoChannelData = {
@@ -16,7 +14,7 @@ async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account
   }
 
   const videoChannel = db.VideoChannel.build(videoChannelData)
-  videoChannel.set('url', getActivityPubUrl('videoChannel', videoChannel.uuid))
+  videoChannel.set('url', getVideoChannelActivityPubUrl(videoChannel))
 
   const options = { transaction: t }
 
@@ -25,9 +23,7 @@ async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account
   // Do not forget to add Account information to the created video channel
   videoChannelCreated.Account = account
 
-  await sendCreateVideoChannel(videoChannelCreated, t)
-  await shareVideoChannelByServer(videoChannelCreated, t)
-
+  // No need to seed this empty video channel to followers
   return videoChannelCreated
 }