1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Add federation to ownership change

This commit is contained in:
Chocobozzz 2018-09-04 10:22:10 +02:00
parent 0b74c74abe
commit 5cf84858d4
No known key found for this signature in database
GPG key ID: 583A612D890159BE
13 changed files with 139 additions and 79 deletions

View file

@ -104,17 +104,19 @@ function processUndoFollow (actorUrl: string, followActivity: ActivityFollow) {
function processUndoAnnounce (actorUrl: string, announceActivity: ActivityAnnounce) {
return sequelizeTypescript.transaction(async t => {
const byAccount = await AccountModel.loadByUrl(actorUrl, t)
if (!byAccount) throw new Error('Unknown account ' + actorUrl)
const byActor = await ActorModel.loadByUrl(actorUrl, t)
if (!byActor) throw new Error('Unknown actor ' + actorUrl)
const share = await VideoShareModel.loadByUrl(announceActivity.id, t)
if (!share) throw new Error(`'Unknown video share ${announceActivity.id}.`)
if (!share) throw new Error(`Unknown video share ${announceActivity.id}.`)
if (share.actorId !== byActor.id) throw new Error(`${share.url} is not shared by ${byActor.url}.`)
await share.destroy({ transaction: t })
if (share.Video.isOwned()) {
// Don't resend the activity to the sender
const exceptions = [ byAccount.Actor ]
const exceptions = [ byActor ]
await forwardVideoRelatedActivity(announceActivity, t, exceptions, share.Video)
}