Fix chat visibility and conversation sync

This commit is contained in:
jjbrunton committed 2026-08-08 19:29:40 +01:00
1 parent f4e8fdc42f
commit 34ae532cdd
10 files changed
+416 -23

No files matched your search

+11 -4
View File
@@ -273,11 +273,18 @@ export function createConversationsRouter(ctx: WebContext): Router {
}
ctx.activity.push('sent', `Sent chat reply to u/${conversation.username}`, conversation.username);
ctx.broadcaster.push('info', `Chat reply sent to u/${conversation.username}`);
try {
// Wait for Matrix /sync to merge the sent event into the cached
// message history. The dashboard invalidates its queries when this
// request completes, so returning earlier can immediately re-read
// the stale pre-send conversation.
await ctx.services.chat.refreshTopChats(5);
} catch (err) {
// Delivery is already confirmed by Matrix's send response. A sync
// failure must not turn a successful send into a reported failure.
ctx.logger.error('Failed to refresh chats after send-reply:', err);
}
res.json({ success: true });
ctx.services.chat.refreshTopChats(5).catch((err) =>
ctx.logger.error('Failed to refresh chats after send-reply:', err),
);
} else {
res.status(500).json({ error: 'Failed to send chat message' });
}