refactor(federation): replace outbox hooks in dm.ts with queueDmRelay()
This commit is contained in:
@@ -21,7 +21,7 @@ import {
|
||||
import { sanitizeUser } from '../utils/sanitize.js';
|
||||
import { deleteUploadFile, deleteAttachmentFiles } from '../utils/fileCleanup.js';
|
||||
import { fetchDmEmbedsForMessages, resolveEmbeds, reResolveEmbeds, embedRowToEmbed } from '../utils/embedResolver.js';
|
||||
import { appendMutationLog, queueOutboxEvent, buildRelayPayload, getDmParticipants } from '../utils/federationOutbox.js';
|
||||
import { appendMutationLog, queueOutboxEvent, queueDmRelay } from '../utils/federationOutbox.js';
|
||||
|
||||
/**
|
||||
* Batch-fetch reactions for a set of DM message IDs.
|
||||
@@ -971,13 +971,8 @@ export async function dmRoutes(app: FastifyInstance): Promise<void> {
|
||||
// Broadcast to all DM members (including those who closed the channel)
|
||||
broadcastDmMessage(id, message);
|
||||
|
||||
// Federation: log mutation and queue for relay
|
||||
appendMutationLog(messageId, id, 'create');
|
||||
const participants = getDmParticipants(id);
|
||||
queueOutboxEvent(messageId, id, 'create', JSON.stringify({
|
||||
message: { ...buildRelayPayload(message, message.user), attachments: [] },
|
||||
participants,
|
||||
}));
|
||||
// Federation: queue for relay
|
||||
queueDmRelay(message, id, 'create');
|
||||
|
||||
// Resolve embeds asynchronously after responding
|
||||
setImmediate(() => {
|
||||
@@ -1040,12 +1035,8 @@ export async function dmRoutes(app: FastifyInstance): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
// Federation: log mutation and queue for relay
|
||||
appendMutationLog(id, msg.dmChannelId, 'update');
|
||||
queueOutboxEvent(id, 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