refactor(federation): replace outbox hooks in events.ts with queueDmRelay()
This commit is contained in:
@@ -11,7 +11,7 @@ import { ACTIVITY_LIMITS } from '@backspace/shared/src/activities.js';
|
||||
import { sanitizeUser } from '../utils/sanitize.js';
|
||||
import { deleteAttachmentFiles } from '../utils/fileCleanup.js';
|
||||
import { resolveEmbeds, reResolveEmbeds, embedRowToEmbed } from '../utils/embedResolver.js';
|
||||
import { appendMutationLog, queueOutboxEvent, buildRelayPayload, getDmParticipants } from '../utils/federationOutbox.js';
|
||||
import { appendMutationLog, queueOutboxEvent, queueDmRelay } from '../utils/federationOutbox.js';
|
||||
|
||||
/**
|
||||
* Re-evaluate SPEAK permission for all participants in voice channels
|
||||
@@ -886,13 +886,8 @@ function handleDmMessageCreate(event: Record<string, unknown>, userId: string):
|
||||
// Broadcast to all DM members (including those who closed the channel)
|
||||
broadcastDmMessage(dmChannelId, dmMessage);
|
||||
|
||||
// Federation: log mutation and queue for relay
|
||||
appendMutationLog(messageId, dmChannelId, 'create');
|
||||
const participants = getDmParticipants(dmChannelId);
|
||||
queueOutboxEvent(messageId, dmChannelId, 'create', JSON.stringify({
|
||||
message: { ...buildRelayPayload(dmMessage, dmMessage.user), attachments: [] },
|
||||
participants,
|
||||
}));
|
||||
// Federation: queue for relay
|
||||
queueDmRelay(dmMessage, dmChannelId, 'create');
|
||||
|
||||
// Resolve embeds asynchronously
|
||||
setImmediate(() => {
|
||||
@@ -992,12 +987,8 @@ function handleDmMessageEdit(event: Record<string, unknown>, userId: string): vo
|
||||
});
|
||||
}
|
||||
|
||||
// Federation: log mutation and queue for relay
|
||||
appendMutationLog(messageId, msg.dmChannelId, 'update');
|
||||
queueOutboxEvent(messageId, msg.dmChannelId, 'update', JSON.stringify({
|
||||
message: buildRelayPayload(updated, updated.user),
|
||||
participants: getDmParticipants(msg.dmChannelId),
|
||||
}));
|
||||
// Federation: queue for relay
|
||||
queueDmRelay(updated, msg.dmChannelId, 'update');
|
||||
|
||||
// Resolve new embeds asynchronously (old ones already deleted above)
|
||||
setImmediate(() => {
|
||||
|
||||
Reference in New Issue
Block a user