aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-18 10:53:54 +0100
committerChocobozzz <me@florianbigard.com>2018-01-18 15:42:20 +0100
commitf05a1c30c15d2ae35c11e241ca039a72eeb7d6ad (patch)
tree6d90c0de5dd3ad506e738d447e4f396951ed5624 /server/lib/activitypub/process
parent1174a8479ab9ee47b3305d668fe757435057a298 (diff)
downloadPeerTube-f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad.tar.gz
PeerTube-f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad.tar.zst
PeerTube-f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad.zip
Don't show videos of remote instance after unfollow
Diffstat (limited to 'server/lib/activitypub/process')
-rw-r--r--server/lib/activitypub/process/process-delete.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts
index 07e6a0075..03eadcbfc 100644
--- a/server/lib/activitypub/process/process-delete.ts
+++ b/server/lib/activitypub/process/process-delete.ts
@@ -10,21 +10,26 @@ import { VideoCommentModel } from '../../../models/video/video-comment'
10import { getOrCreateActorAndServerAndModel } from '../actor' 10import { getOrCreateActorAndServerAndModel } from '../actor'
11 11
12async function processDeleteActivity (activity: ActivityDelete) { 12async function processDeleteActivity (activity: ActivityDelete) {
13 const actor = await getOrCreateActorAndServerAndModel(activity.actor)
14 const objectUrl = typeof activity.object === 'string' ? activity.object : activity.object.id 13 const objectUrl = typeof activity.object === 'string' ? activity.object : activity.object.id
15 14
16 if (actor.url === objectUrl) { 15 if (activity.actor === objectUrl) {
16 let actor = await ActorModel.loadByUrl(activity.actor)
17 if (!actor) return
18
17 if (actor.type === 'Person') { 19 if (actor.type === 'Person') {
18 if (!actor.Account) throw new Error('Actor ' + actor.url + ' is a person but we cannot find it in database.') 20 if (!actor.Account) throw new Error('Actor ' + actor.url + ' is a person but we cannot find it in database.')
19 21
22 actor.Account.Actor = await actor.Account.$get('Actor') as ActorModel
20 return processDeleteAccount(actor.Account) 23 return processDeleteAccount(actor.Account)
21 } else if (actor.type === 'Group') { 24 } else if (actor.type === 'Group') {
22 if (!actor.VideoChannel) throw new Error('Actor ' + actor.url + ' is a group but we cannot find it in database.') 25 if (!actor.VideoChannel) throw new Error('Actor ' + actor.url + ' is a group but we cannot find it in database.')
23 26
27 actor.VideoChannel.Actor = await actor.VideoChannel.$get('Actor') as ActorModel
24 return processDeleteVideoChannel(actor.VideoChannel) 28 return processDeleteVideoChannel(actor.VideoChannel)
25 } 29 }
26 } 30 }
27 31
32 const actor = await getOrCreateActorAndServerAndModel(activity.actor)
28 { 33 {
29 const videoCommentInstance = await VideoCommentModel.loadByUrlAndPopulateAccount(objectUrl) 34 const videoCommentInstance = await VideoCommentModel.loadByUrlAndPopulateAccount(objectUrl)
30 if (videoCommentInstance) { 35 if (videoCommentInstance) {