fix: read receipts (single/double check), push notifications for all users
- Track when others read messages via messages_read WS event - Show Check (single) for sent, CheckCheck (double) only when read - Send push to all recipients, SW suppresses if app is focused Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,13 +27,10 @@ async function getChatMemberIds(chatId: string): Promise<string[]> {
|
||||
}
|
||||
|
||||
async function sendPushToOfflineUsers(uids: string[], payload: object) {
|
||||
const online = new Set(connections.keys());
|
||||
const offline = uids.filter(id => !online.has(id));
|
||||
if (offline.length === 0) return;
|
||||
|
||||
// Send to all — SW on client side will suppress if app is in foreground
|
||||
const { rows } = await pool.query(
|
||||
'SELECT endpoint, auth_key, p256dh FROM push_subscriptions WHERE user_id = ANY($1)',
|
||||
[offline]
|
||||
[uids]
|
||||
);
|
||||
|
||||
const body = JSON.stringify(payload);
|
||||
|
||||
Reference in New Issue
Block a user