fix: move activityHandlers outside performOneActivity

This commit is contained in:
ThatOneCalculator 2023-08-23 20:57:46 -07:00
parent 92d1d22228
commit aa84e2ab18
No known key found for this signature in database
GPG key ID: 8703CACD01000000

View file

@ -22,6 +22,24 @@ import type { IObject } from "../type.js";
import { extractDbHost } from "@/misc/convert-host.js";
import { shouldBlockInstance } from "@/misc/should-block-instance.js";
const activityHandlers: { [key: string]: Function } = {
Create: create,
Delete: performDeleteActivity,
Update: performUpdateActivity,
Read: performReadActivity,
Follow: follow,
Accept: accept,
Reject: reject,
Add: add,
Remove: remove,
Announce: announce,
Like: like,
Undo: undo,
Block: block,
Flag: flag,
Move: move,
};
export async function performActivity(
actor: CacheableRemoteUser,
activity: IObject,
@ -58,24 +76,6 @@ async function performOneActivity(
if (await shouldBlockInstance(host)) return;
}
const activityHandlers: { [key: string]: Function } = {
Create: create,
Delete: performDeleteActivity,
Update: performUpdateActivity,
Read: performReadActivity,
Follow: follow,
Accept: accept,
Reject: reject,
Add: add,
Remove: remove,
Announce: announce,
Like: like,
Undo: undo,
Block: block,
Flag: flag,
Move: move,
};
const handler = activityHandlers[activityTypes.getApType(activity)];
if (handler) {