diff options
Diffstat (limited to 'server/lib')
4 files changed, 9 insertions, 8 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 | ||
diff --git a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler.ts b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler.ts index 884ede5a3..10423a7df 100644 --- a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler.ts +++ b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler.ts | |||
@@ -4,7 +4,6 @@ import { logger } from '../../../helpers/logger' | |||
4 | import { getServerActor } from '../../../helpers/utils' | 4 | import { getServerActor } from '../../../helpers/utils' |
5 | import { ACTIVITY_PUB } from '../../../initializers' | 5 | import { ACTIVITY_PUB } from '../../../initializers' |
6 | import { ActorModel } from '../../../models/activitypub/actor' | 6 | import { ActorModel } from '../../../models/activitypub/actor' |
7 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | ||
8 | import { JobHandler, JobScheduler } from '../job-scheduler' | 7 | import { JobHandler, JobScheduler } from '../job-scheduler' |
9 | 8 | ||
10 | import * as activitypubHttpBroadcastHandler from './activitypub-http-broadcast-handler' | 9 | import * as activitypubHttpBroadcastHandler from './activitypub-http-broadcast-handler' |
diff --git a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts index e02bd698e..deedf8402 100644 --- a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts +++ b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts | |||
@@ -19,11 +19,11 @@ async function process (payload: ActivityPubHttpPayload, jobId: number) { | |||
19 | 19 | ||
20 | try { | 20 | try { |
21 | await doRequest(options) | 21 | await doRequest(options) |
22 | await ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([ uri ], [], undefined) | 22 | ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([ uri ], [], undefined) |
23 | } catch (err) { | 23 | } catch (err) { |
24 | const isRetryingLater = await maybeRetryRequestLater(err, payload, uri) | 24 | const isRetryingLater = await maybeRetryRequestLater(err, payload, uri) |
25 | if (isRetryingLater === false) { | 25 | if (isRetryingLater === false) { |
26 | await ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([], [ uri ], undefined) | 26 | ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([], [ uri ], undefined) |
27 | } | 27 | } |
28 | 28 | ||
29 | throw err | 29 | throw err |