feat: relay dm_close and dm_reopen to federated peers
Queue dm_close relay in DELETE /api/dm/:id after broadcasting locally, and queue dm_reopen relay inside the myDm.closed === 1 branch of POST /api/dm so peers are notified only on actual reopen, not new DM creation.
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
|||||||
appendMutationLog,
|
appendMutationLog,
|
||||||
queueOutboxEvent,
|
queueOutboxEvent,
|
||||||
queueDmRelay,
|
queueDmRelay,
|
||||||
|
queueDmCloseRelay,
|
||||||
getDmParticipants,
|
getDmParticipants,
|
||||||
getGroupDmTargetOrigins,
|
getGroupDmTargetOrigins,
|
||||||
isFederationRelayEnabled,
|
isFederationRelayEnabled,
|
||||||
@@ -445,6 +446,9 @@ export async function dmRoutes(app: FastifyInstance): Promise<void> {
|
|||||||
eq(schema.dmMembers.userId, request.userId),
|
eq(schema.dmMembers.userId, request.userId),
|
||||||
))
|
))
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
|
// Relay reopen to federated peers
|
||||||
|
queueDmCloseRelay(myDm.dmChannelId, request.userId, 'dm_reopen');
|
||||||
}
|
}
|
||||||
|
|
||||||
const dmMemberRows = db.select()
|
const dmMemberRows = db.select()
|
||||||
@@ -854,6 +858,9 @@ export async function dmRoutes(app: FastifyInstance): Promise<void> {
|
|||||||
dmChannelId: id,
|
dmChannelId: id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Relay close to federated peers
|
||||||
|
queueDmCloseRelay(id, request.userId, 'dm_close');
|
||||||
|
|
||||||
return reply.code(200).send({ success: true });
|
return reply.code(200).send({ success: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user