From 1f2742ddd7ba462b715a4fe2ae25d3dedebec3e0 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Thu, 5 Jun 2025 12:54:58 -0400 Subject: add ignoreRemote filter to InternalEventService --- packages/backend/src/core/InternalEventService.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'packages/backend/src/core/InternalEventService.ts') diff --git a/packages/backend/src/core/InternalEventService.ts b/packages/backend/src/core/InternalEventService.ts index 375ee928c4..5b164b605e 100644 --- a/packages/backend/src/core/InternalEventService.ts +++ b/packages/backend/src/core/InternalEventService.ts @@ -10,10 +10,11 @@ import { GlobalEventService } from '@/core/GlobalEventService.js'; import type { GlobalEvents, InternalEventTypes } from '@/core/GlobalEventService.js'; import { bindThis } from '@/decorators.js'; -export type Listener = (value: InternalEventTypes[K], key: K) => void | Promise; +export type Listener = (value: InternalEventTypes[K], key: K, isLocal: boolean) => void | Promise; export interface ListenerProps { ignoreLocal?: boolean, + ignoreRemote?: boolean, } @Injectable() @@ -61,8 +62,8 @@ export class InternalEventService implements OnApplicationShutdown { const promises: Promise[] = []; for (const [listener, props] of listeners) { - if (!isLocal || !props.ignoreLocal) { - const promise = Promise.resolve(listener(value, type)); + if ((isLocal && !props.ignoreLocal) || (!isLocal && !props.ignoreRemote)) { + const promise = Promise.resolve(listener(value, type, isLocal)); promises.push(promise); } } -- cgit v1.2.3-freya