aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/share.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/share.ts')
-rw-r--r--server/lib/activitypub/share.ts24
1 files changed, 5 insertions, 19 deletions
diff --git a/server/lib/activitypub/share.ts b/server/lib/activitypub/share.ts
index 5bec61c05..f79c4e532 100644
--- a/server/lib/activitypub/share.ts
+++ b/server/lib/activitypub/share.ts
@@ -1,34 +1,20 @@
1import { Transaction } from 'sequelize' 1import { Transaction } from 'sequelize'
2import { getServerAccount } from '../../helpers' 2import { getServerActor } from '../../helpers'
3import { VideoModel } from '../../models/video/video' 3import { VideoModel } from '../../models/video/video'
4import { VideoChannelModel } from '../../models/video/video-channel'
5import { VideoChannelShareModel } from '../../models/video/video-channel-share'
6import { VideoShareModel } from '../../models/video/video-share' 4import { VideoShareModel } from '../../models/video/video-share'
7import { sendVideoAnnounceToFollowers, sendVideoChannelAnnounceToFollowers } from './send' 5import { sendVideoAnnounceToFollowers } from './send'
8
9async function shareVideoChannelByServer (videoChannel: VideoChannelModel, t: Transaction) {
10 const serverAccount = await getServerAccount()
11
12 await VideoChannelShareModel.create({
13 accountId: serverAccount.id,
14 videoChannelId: videoChannel.id
15 }, { transaction: t })
16
17 return sendVideoChannelAnnounceToFollowers(serverAccount, videoChannel, t)
18}
19 6
20async function shareVideoByServer (video: VideoModel, t: Transaction) { 7async function shareVideoByServer (video: VideoModel, t: Transaction) {
21 const serverAccount = await getServerAccount() 8 const serverActor = await getServerActor()
22 9
23 await VideoShareModel.create({ 10 await VideoShareModel.create({
24 accountId: serverAccount.id, 11 actorId: serverActor.id,
25 videoId: video.id 12 videoId: video.id
26 }, { transaction: t }) 13 }, { transaction: t })
27 14
28 return sendVideoAnnounceToFollowers(serverAccount, video, t) 15 return sendVideoAnnounceToFollowers(serverActor, video, t)
29} 16}
30 17
31export { 18export {
32 shareVideoChannelByServer,
33 shareVideoByServer 19 shareVideoByServer
34} 20}