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.ts18
1 files changed, 14 insertions, 4 deletions
diff --git a/server/lib/activitypub/process/process-undo.ts b/server/lib/activitypub/process/process-undo.ts
index d023f7029..37db58e1a 100644
--- a/server/lib/activitypub/process/process-undo.ts
+++ b/server/lib/activitypub/process/process-undo.ts
@@ -8,7 +8,7 @@ import { AccountModel } from '../../../models/account/account'
8import { AccountVideoRateModel } from '../../../models/account/account-video-rate' 8import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
9import { ActorModel } from '../../../models/activitypub/actor' 9import { ActorModel } from '../../../models/activitypub/actor'
10import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 10import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
11import { forwardActivity } from '../send/utils' 11import { forwardVideoRelatedActivity } from '../send/utils'
12import { getOrCreateAccountAndVideoAndChannel } from '../videos' 12import { getOrCreateAccountAndVideoAndChannel } from '../videos'
13import { VideoShareModel } from '../../../models/video/video-share' 13import { VideoShareModel } from '../../../models/video/video-share'
14 14
@@ -67,7 +67,8 @@ async function undoLike (actorUrl: string, activity: ActivityUndo) {
67 if (video.isOwned()) { 67 if (video.isOwned()) {
68 // Don't resend the activity to the sender 68 // Don't resend the activity to the sender
69 const exceptions = [ byAccount.Actor ] 69 const exceptions = [ byAccount.Actor ]
70 await forwardActivity(activity, t, exceptions) 70
71 await forwardVideoRelatedActivity(activity, t, exceptions, video)
71 } 72 }
72 }) 73 })
73} 74}
@@ -99,7 +100,8 @@ async function undoDislike (actorUrl: string, activity: ActivityUndo) {
99 if (video.isOwned()) { 100 if (video.isOwned()) {
100 // Don't resend the activity to the sender 101 // Don't resend the activity to the sender
101 const exceptions = [ byAccount.Actor ] 102 const exceptions = [ byAccount.Actor ]
102 await forwardActivity(activity, t, exceptions) 103
104 await forwardVideoRelatedActivity(activity, t, exceptions, video)
103 } 105 }
104 }) 106 })
105} 107}
@@ -138,11 +140,19 @@ function processUndoAnnounce (actorUrl: string, announceActivity: ActivityAnnoun
138 140
139function undoAnnounce (actorUrl: string, announceActivity: ActivityAnnounce) { 141function undoAnnounce (actorUrl: string, announceActivity: ActivityAnnounce) {
140 return sequelizeTypescript.transaction(async t => { 142 return sequelizeTypescript.transaction(async t => {
143 const byAccount = await AccountModel.loadByUrl(actorUrl, t)
144 if (!byAccount) throw new Error('Unknown account ' + actorUrl)
145
141 const share = await VideoShareModel.loadByUrl(announceActivity.id, t) 146 const share = await VideoShareModel.loadByUrl(announceActivity.id, t)
142 if (!share) throw new Error(`'Unknown video share ${announceActivity.id}.`) 147 if (!share) throw new Error(`'Unknown video share ${announceActivity.id}.`)
143 148
144 await share.destroy({ transaction: t }) 149 await share.destroy({ transaction: t })
145 150
146 return undefined 151 if (share.Video.isOwned()) {
152 // Don't resend the activity to the sender
153 const exceptions = [ byAccount.Actor ]
154
155 await forwardVideoRelatedActivity(announceActivity, t, exceptions, share.Video)
156 }
147 }) 157 })
148} 158}