fix: ⚡ move activityHandlers outside performOneActivity
This commit is contained in:
parent
92d1d22228
commit
aa84e2ab18
1 changed files with 18 additions and 18 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue