fix: relay mark_unread to peers, fix docs and timestamp consistency
- Add queueReadStateRelay call in handleMarkUnread (skip '0' sentinel) - Fix double Date.now() in queueReadStateRelay (use single const) - Fix federation.md: read state relay uses outbox (not fire-and-forget), correct payload schema to match implementation
This commit is contained in:
@@ -519,13 +519,14 @@ export function queueReadStateRelay(
|
||||
messageRef = { sourceInstance: ourOrigin, sourceMessageId: messageId };
|
||||
}
|
||||
|
||||
const now = Date.now();
|
||||
const payload: FederationRelayEvent = {
|
||||
eventType: 'read_state_update',
|
||||
dmChannelId: channelId,
|
||||
messageId: `read_state:${userId}:${Date.now()}`,
|
||||
messageId: `read_state:${userId}:${now}`,
|
||||
federatedId: channel.federatedId,
|
||||
encryptionVersion: 0,
|
||||
timestamp: Date.now(),
|
||||
timestamp: now,
|
||||
readState: {
|
||||
user: { homeUserId, homeInstance },
|
||||
messageRef,
|
||||
|
||||
@@ -1384,6 +1384,12 @@ function handleMarkUnread(event: Record<string, unknown>, userId: string, isFede
|
||||
channelId,
|
||||
messageId,
|
||||
});
|
||||
|
||||
// Relay mark-unread to federated peers for cross-instance sync
|
||||
// (skip the '0' sentinel — it deletes the read state and can't be mapped to a message)
|
||||
if (messageId !== '0') {
|
||||
queueReadStateRelay(channelId, messageId, userId);
|
||||
}
|
||||
}
|
||||
|
||||
// ─── DM Call Handlers (Unified Room API) ───────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user