]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/lib/activitypub/share.ts
f79c4e532af10d1da5b4578680b1e752ed4a3e46
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / share.ts
1 import { Transaction } from 'sequelize'
2 import { getServerActor } from '../../helpers'
3 import { VideoModel } from '../../models/video/video'
4 import { VideoShareModel } from '../../models/video/video-share'
5 import { sendVideoAnnounceToFollowers } from './send'
6
7 async function shareVideoByServer (video: VideoModel, t: Transaction) {
8 const serverActor = await getServerActor()
9
10 await VideoShareModel.create({
11 actorId: serverActor.id,
12 videoId: video.id
13 }, { transaction: t })
14
15 return sendVideoAnnounceToFollowers(serverActor, video, t)
16 }
17
18 export {
19 shareVideoByServer
20 }