diff options
Diffstat (limited to 'server/lib/activitypub/share.ts')
-rw-r--r-- | server/lib/activitypub/share.ts | 24 |
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 @@ | |||
1 | import { Transaction } from 'sequelize' | 1 | import { Transaction } from 'sequelize' |
2 | import { getServerAccount } from '../../helpers' | 2 | import { getServerActor } from '../../helpers' |
3 | import { VideoModel } from '../../models/video/video' | 3 | import { VideoModel } from '../../models/video/video' |
4 | import { VideoChannelModel } from '../../models/video/video-channel' | ||
5 | import { VideoChannelShareModel } from '../../models/video/video-channel-share' | ||
6 | import { VideoShareModel } from '../../models/video/video-share' | 4 | import { VideoShareModel } from '../../models/video/video-share' |
7 | import { sendVideoAnnounceToFollowers, sendVideoChannelAnnounceToFollowers } from './send' | 5 | import { sendVideoAnnounceToFollowers } from './send' |
8 | |||
9 | async 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 | ||
20 | async function shareVideoByServer (video: VideoModel, t: Transaction) { | 7 | async 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 | ||
31 | export { | 18 | export { |
32 | shareVideoChannelByServer, | ||
33 | shareVideoByServer | 19 | shareVideoByServer |
34 | } | 20 | } |