diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-15 17:34:38 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-19 10:53:16 +0100 |
commit | a7d647c4403f8774106f485e8d9323158454e111 (patch) | |
tree | fcba0e03ce3ac2bf1cc7607a1643ffd1bc206c2b /server/lib/activitypub | |
parent | 50d6de9c286abcb34ff4234d56d9cbb803db7665 (diff) | |
download | PeerTube-a7d647c4403f8774106f485e8d9323158454e111.tar.gz PeerTube-a7d647c4403f8774106f485e8d9323158454e111.tar.zst PeerTube-a7d647c4403f8774106f485e8d9323158454e111.zip |
Add dirty migration :/
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/share.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/server/lib/activitypub/share.ts b/server/lib/activitypub/share.ts index f79c4e532..fb01368ec 100644 --- a/server/lib/activitypub/share.ts +++ b/server/lib/activitypub/share.ts | |||
@@ -4,17 +4,27 @@ import { VideoModel } from '../../models/video/video' | |||
4 | import { VideoShareModel } from '../../models/video/video-share' | 4 | import { VideoShareModel } from '../../models/video/video-share' |
5 | import { sendVideoAnnounceToFollowers } from './send' | 5 | import { sendVideoAnnounceToFollowers } from './send' |
6 | 6 | ||
7 | async function shareVideoByServer (video: VideoModel, t: Transaction) { | 7 | async function shareVideoByServerAndChannel (video: VideoModel, t: Transaction) { |
8 | const serverActor = await getServerActor() | 8 | const serverActor = await getServerActor() |
9 | 9 | ||
10 | await VideoShareModel.create({ | 10 | const serverShare = VideoShareModel.create({ |
11 | actorId: serverActor.id, | 11 | actorId: serverActor.id, |
12 | videoId: video.id | 12 | videoId: video.id |
13 | }, { transaction: t }) | 13 | }, { transaction: t }) |
14 | 14 | ||
15 | const videoChannelShare = VideoShareModel.create({ | ||
16 | actorId: video.VideoChannel.actorId, | ||
17 | videoId: video.id | ||
18 | }, { transaction: t }) | ||
19 | |||
20 | await Promise.all([ | ||
21 | serverShare, | ||
22 | videoChannelShare | ||
23 | ]) | ||
24 | |||
15 | return sendVideoAnnounceToFollowers(serverActor, video, t) | 25 | return sendVideoAnnounceToFollowers(serverActor, video, t) |
16 | } | 26 | } |
17 | 27 | ||
18 | export { | 28 | export { |
19 | shareVideoByServer | 29 | shareVideoByServerAndChannel |
20 | } | 30 | } |