aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/share.ts
blob: f79c4e532af10d1da5b4578680b1e752ed4a3e46 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { Transaction } from 'sequelize'
import { getServerActor } from '../../helpers'
import { VideoModel } from '../../models/video/video'
import { VideoShareModel } from '../../models/video/video-share'
import { sendVideoAnnounceToFollowers } from './send'

async function shareVideoByServer (video: VideoModel, t: Transaction) {
  const serverActor = await getServerActor()

  await VideoShareModel.create({
    actorId: serverActor.id,
    videoId: video.id
  }, { transaction: t })

  return sendVideoAnnounceToFollowers(serverActor, video, t)
}

export {
  shareVideoByServer
}