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:
parent
fadf619ad6
commit
50d6de9c28
100 changed files with 1761 additions and 2041 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue