1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Begin moving video channel to actor

This commit is contained in:
Chocobozzz 2017-12-14 17:38:41 +01:00
parent fadf619ad6
commit 50d6de9c28
No known key found for this signature in database
GPG key ID: 583A612D890159BE
100 changed files with 1761 additions and 2041 deletions

View file

@ -1,34 +1,20 @@
import { Transaction } from 'sequelize'
import { getServerAccount } from '../../helpers'
import { getServerActor } from '../../helpers'
import { VideoModel } from '../../models/video/video'
import { VideoChannelModel } from '../../models/video/video-channel'
import { VideoChannelShareModel } from '../../models/video/video-channel-share'
import { VideoShareModel } from '../../models/video/video-share'
import { sendVideoAnnounceToFollowers, sendVideoChannelAnnounceToFollowers } from './send'
async function shareVideoChannelByServer (videoChannel: VideoChannelModel, t: Transaction) {
const serverAccount = await getServerAccount()
await VideoChannelShareModel.create({
accountId: serverAccount.id,
videoChannelId: videoChannel.id
}, { transaction: t })
return sendVideoChannelAnnounceToFollowers(serverAccount, videoChannel, t)
}
import { sendVideoAnnounceToFollowers } from './send'
async function shareVideoByServer (video: VideoModel, t: Transaction) {
const serverAccount = await getServerAccount()
const serverActor = await getServerActor()
await VideoShareModel.create({
accountId: serverAccount.id,
actorId: serverActor.id,
videoId: video.id
}, { transaction: t })
return sendVideoAnnounceToFollowers(serverAccount, video, t)
return sendVideoAnnounceToFollowers(serverActor, video, t)
}
export {
shareVideoChannelByServer,
shareVideoByServer
}