aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-11 11:40:18 +0100
committerChocobozzz <me@florianbigard.com>2018-01-11 11:47:44 +0100
commit7bc29171456ffa91c7ec8dc77e892c7dca359989 (patch)
treec7682072919bf00f8b082c1c49f24567e181800f /server/lib/activitypub
parent85cd9bde5a93500f973773f46680c07dd90d5912 (diff)
downloadPeerTube-7bc29171456ffa91c7ec8dc77e892c7dca359989.tar.gz
PeerTube-7bc29171456ffa91c7ec8dc77e892c7dca359989.tar.zst
PeerTube-7bc29171456ffa91c7ec8dc77e892c7dca359989.zip
Add tests to handle down server
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r--server/lib/activitypub/process/process-accept.ts8
-rw-r--r--server/lib/activitypub/process/process-create.ts4
2 files changed, 7 insertions, 5 deletions
diff --git a/server/lib/activitypub/process/process-accept.ts b/server/lib/activitypub/process/process-accept.ts
index b9d906ec9..551f09ea7 100644
--- a/server/lib/activitypub/process/process-accept.ts
+++ b/server/lib/activitypub/process/process-accept.ts
@@ -23,7 +23,9 @@ async function processAccept (actor: ActorModel, targetActor: ActorModel) {
23 const follow = await ActorFollowModel.loadByActorAndTarget(actor.id, targetActor.id) 23 const follow = await ActorFollowModel.loadByActorAndTarget(actor.id, targetActor.id)
24 if (!follow) throw new Error('Cannot find associated follow.') 24 if (!follow) throw new Error('Cannot find associated follow.')
25 25
26 follow.set('state', 'accepted') 26 if (follow.state !== 'accepted') {
27 await follow.save() 27 follow.set('state', 'accepted')
28 await addFetchOutboxJob(targetActor, undefined) 28 await follow.save()
29 await addFetchOutboxJob(targetActor, undefined)
30 }
29} 31}
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts
index 08d61996a..442cd5c0b 100644
--- a/server/lib/activitypub/process/process-create.ts
+++ b/server/lib/activitypub/process/process-create.ts
@@ -147,8 +147,8 @@ async function processCreateView (byActor: ActorModel, activity: ActivityCreate)
147 147
148 const { video } = await getOrCreateAccountAndVideoAndChannel(view.object) 148 const { video } = await getOrCreateAccountAndVideoAndChannel(view.object)
149 149
150 const account = await ActorModel.loadByUrl(view.actor) 150 const actor = await ActorModel.loadByUrl(view.actor)
151 if (!account) throw new Error('Unknown account ' + view.actor) 151 if (!actor) throw new Error('Unknown actor ' + view.actor)
152 152
153 await video.increment('views') 153 await video.increment('views')
154 154