realtime: emit and handle chat_deleted for full chat removals
All checks were successful
CI / test (push) Successful in 38s

This commit is contained in:
2026-03-08 19:41:49 +03:00
parent a896568c53
commit 744ded914d
7 changed files with 73 additions and 4 deletions

View File

@@ -39,8 +39,8 @@ Legend:
30. Blacklist - `DONE`
31. Privacy - `PARTIAL` (avatar/last-seen/group-invites + PM policy `everyone|contacts|nobody`; policy behavior covered by integration tests, remaining UX/matrix hardening)
32. Security - `PARTIAL` (sessions + revoke + 2FA base + access-session visibility; revoke-all now force-disconnects active realtime sessions; 2FA setup now blocked after enable to prevent secret re-issuance; one-time recovery codes added; UX polish ongoing)
33. Realtime Events - `DONE` (connect/disconnect/send/receive/typing/read/delivered/online/offline + chat/message updates)
34. Sync - `PARTIAL` (cross-device via backend state + realtime; reconciliation improved for loaded chats/messages, chat-info panel hot-refreshes on `chat_updated`, delete/leave now updates realtime subscriptions)
33. Realtime Events - `DONE` (connect/disconnect/send/receive/typing/read/delivered/online/offline + chat/message updates + chat_deleted)
34. Sync - `PARTIAL` (cross-device via backend state + realtime; reconciliation improved for loaded chats/messages, chat-info panel hot-refreshes on `chat_updated`, delete/leave updates realtime subscriptions, full-chat delete emits `chat_deleted`)
35. Additional - `PARTIAL` (drafts/link preview partial/autoload media basic)
## Current Focus to reach ~80%

View File

@@ -211,7 +211,21 @@ Sent when chat metadata/membership/roles/title changes:
}
```
## 3.8 `error`
## 3.8 `chat_deleted`
Sent when a chat is removed for all members/subscribers:
```json
{
"event": "chat_deleted",
"payload": {
"chat_id": 10
},
"timestamp": "2026-03-08T12:00:00Z"
}
```
## 3.9 `error`
Validation/runtime error during WS processing:
@@ -236,6 +250,7 @@ Validation/runtime error during WS processing:
- Send periodic `ping` and expect `pong`.
- Reconnect with exponential backoff.
- On `chat_updated`, refresh chat metadata via REST (`GET /api/v1/chats` or `GET /api/v1/chats/{chat_id}`).
- On `chat_deleted`, remove the chat from local state immediately and clear active-chat selection if needed.
- On reconnect/visibility restore, reconcile state by reloading already-opened chats/messages via REST
to recover missed `message_deleted`/delivery updates after transient disconnects or backend restarts.
- For browser notifications, mentions (`@username`) should be treated as high-priority and can bypass