aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/lib/activitypub/process/process-undo.ts20
1 files changed, 16 insertions, 4 deletions
diff --git a/server/lib/activitypub/process/process-undo.ts b/server/lib/activitypub/process/process-undo.ts
index 778a38e05..99423a72b 100644
--- a/server/lib/activitypub/process/process-undo.ts
+++ b/server/lib/activitypub/process/process-undo.ts
@@ -65,7 +65,10 @@ async function processUndoLike (byActor: MActorSignature, activity: ActivityUndo
65 65
66 const video = await VideoModel.loadFull(onlyVideo.id, t) 66 const video = await VideoModel.loadFull(onlyVideo.id, t)
67 const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, likeActivity.id, t) 67 const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, likeActivity.id, t)
68 if (!rate || rate.type !== 'like') throw new Error(`Unknown like by account ${byActor.Account.id} for video ${video.id}.`) 68 if (!rate || rate.type !== 'like') {
69 logger.warn('Unknown like by account %d for video %d.', byActor.Account.id, video.id)
70 return
71 }
69 72
70 await rate.destroy({ transaction: t }) 73 await rate.destroy({ transaction: t })
71 await video.decrement('likes', { transaction: t }) 74 await video.decrement('likes', { transaction: t })
@@ -89,7 +92,10 @@ async function processUndoDislike (byActor: MActorSignature, activity: ActivityU
89 92
90 const video = await VideoModel.loadFull(onlyVideo.id, t) 93 const video = await VideoModel.loadFull(onlyVideo.id, t)
91 const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, dislike.id, t) 94 const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, dislike.id, t)
92 if (!rate || rate.type !== 'dislike') throw new Error(`Unknown dislike by account ${byActor.Account.id} for video ${video.id}.`) 95 if (!rate || rate.type !== 'dislike') {
96 logger.warn(`Unknown dislike by account %d for video %d.`, byActor.Account.id, video.id)
97 return
98 }
93 99
94 await rate.destroy({ transaction: t }) 100 await rate.destroy({ transaction: t })
95 await video.decrement('dislikes', { transaction: t }) 101 await video.decrement('dislikes', { transaction: t })
@@ -129,7 +135,10 @@ async function processUndoCacheFile (byActor: MActorSignature, activity: Activit
129function processUndoAnnounce (byActor: MActorSignature, announceActivity: ActivityAnnounce) { 135function processUndoAnnounce (byActor: MActorSignature, announceActivity: ActivityAnnounce) {
130 return sequelizeTypescript.transaction(async t => { 136 return sequelizeTypescript.transaction(async t => {
131 const share = await VideoShareModel.loadByUrl(announceActivity.id, t) 137 const share = await VideoShareModel.loadByUrl(announceActivity.id, t)
132 if (!share) throw new Error(`Unknown video share ${announceActivity.id}.`) 138 if (!share) {
139 logger.warn('Unknown video share %d', announceActivity.id)
140 return
141 }
133 142
134 if (share.actorId !== byActor.id) throw new Error(`${share.url} is not shared by ${byActor.url}.`) 143 if (share.actorId !== byActor.id) throw new Error(`${share.url} is not shared by ${byActor.url}.`)
135 144
@@ -151,7 +160,10 @@ function processUndoFollow (follower: MActorSignature, followActivity: ActivityF
151 const following = await ActorModel.loadByUrlAndPopulateAccountAndChannel(followActivity.object, t) 160 const following = await ActorModel.loadByUrlAndPopulateAccountAndChannel(followActivity.object, t)
152 const actorFollow = await ActorFollowModel.loadByActorAndTarget(follower.id, following.id, t) 161 const actorFollow = await ActorFollowModel.loadByActorAndTarget(follower.id, following.id, t)
153 162
154 if (!actorFollow) throw new Error(`'Unknown actor follow ${follower.id} -> ${following.id}.`) 163 if (!actorFollow) {
164 logger.warn('Unknown actor follow %d -> %d.', follower.id, following.id)
165 return
166 }
155 167
156 await actorFollow.destroy({ transaction: t }) 168 await actorFollow.destroy({ transaction: t })
157 169