diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-04 10:22:10 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-04 10:49:53 +0200 |
commit | 5cf84858d49f4231cc4efec5e3132f17f65f6cf6 (patch) | |
tree | f1ff23476ff54c32c3fa34db79c11f242855d3b4 /server/lib/activitypub/process | |
parent | 0b74c74abe5a44e9f564ab6adb5177ab17d28e91 (diff) | |
download | PeerTube-5cf84858d49f4231cc4efec5e3132f17f65f6cf6.tar.gz PeerTube-5cf84858d49f4231cc4efec5e3132f17f65f6cf6.tar.zst PeerTube-5cf84858d49f4231cc4efec5e3132f17f65f6cf6.zip |
Add federation to ownership change
Diffstat (limited to 'server/lib/activitypub/process')
-rw-r--r-- | server/lib/activitypub/process/process-undo.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/server/lib/activitypub/process/process-undo.ts b/server/lib/activitypub/process/process-undo.ts index eab9e3d61..1c1de8827 100644 --- a/server/lib/activitypub/process/process-undo.ts +++ b/server/lib/activitypub/process/process-undo.ts | |||
@@ -104,17 +104,19 @@ function processUndoFollow (actorUrl: string, followActivity: ActivityFollow) { | |||
104 | 104 | ||
105 | function processUndoAnnounce (actorUrl: string, announceActivity: ActivityAnnounce) { | 105 | function processUndoAnnounce (actorUrl: string, announceActivity: ActivityAnnounce) { |
106 | return sequelizeTypescript.transaction(async t => { | 106 | return sequelizeTypescript.transaction(async t => { |
107 | const byAccount = await AccountModel.loadByUrl(actorUrl, t) | 107 | const byActor = await ActorModel.loadByUrl(actorUrl, t) |
108 | if (!byAccount) throw new Error('Unknown account ' + actorUrl) | 108 | if (!byActor) throw new Error('Unknown actor ' + actorUrl) |
109 | 109 | ||
110 | const share = await VideoShareModel.loadByUrl(announceActivity.id, t) | 110 | const share = await VideoShareModel.loadByUrl(announceActivity.id, t) |
111 | if (!share) throw new Error(`'Unknown video share ${announceActivity.id}.`) | 111 | if (!share) throw new Error(`Unknown video share ${announceActivity.id}.`) |
112 | |||
113 | if (share.actorId !== byActor.id) throw new Error(`${share.url} is not shared by ${byActor.url}.`) | ||
112 | 114 | ||
113 | await share.destroy({ transaction: t }) | 115 | await share.destroy({ transaction: t }) |
114 | 116 | ||
115 | if (share.Video.isOwned()) { | 117 | if (share.Video.isOwned()) { |
116 | // Don't resend the activity to the sender | 118 | // Don't resend the activity to the sender |
117 | const exceptions = [ byAccount.Actor ] | 119 | const exceptions = [ byActor ] |
118 | 120 | ||
119 | await forwardVideoRelatedActivity(announceActivity, t, exceptions, share.Video) | 121 | await forwardVideoRelatedActivity(announceActivity, t, exceptions, share.Video) |
120 | } | 122 | } |