aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process/process-undo.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/process/process-undo.ts')
-rw-r--r--server/lib/activitypub/process/process-undo.ts10
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
105function processUndoAnnounce (actorUrl: string, announceActivity: ActivityAnnounce) { 105function 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 }