feat(chat): unread read-receipts with lobby/game dot and history-open ack
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 15s
CI / ui (pull_request) Successful in 49s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m16s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 15s
CI / ui (pull_request) Successful in 49s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m16s
Persist per-message read state as a chat_messages.unread_seats bitmask
(migration 00008): a text message seeds every recipient seat's bit, a nudge
only the awaited seat's. A seat's bit clears when the player opens the move
history or chat (POST /games/:id/chat/read, sent only when something is
unread), and a nudge additionally clears when its recipient answers by moving
(a wired game NudgeClearer, dependency-inverted so game keeps off social).
UI shows a per-viewer unread dot in the lobby (next to the opponent) and the
game score bar — the unread_chat game-view flag seeds it from authoritative
REST views, live chat/nudge events raise it. Opening the move history counts
as reading (even without entering chat): the 💬 fade-blinks twice and the
client acks. Admin Messages gains an unread-only filter, a read/unread column,
and a per-message card with the per-seat read breakdown. Observability:
chat_read_duration histogram + chat_unread_messages gauge + social tracing.
This commit is contained in:
@@ -94,11 +94,13 @@ type MessagesView struct {
|
||||
ExtMask string
|
||||
GameID string
|
||||
UserID string
|
||||
UnreadOnly bool
|
||||
FilterQuery template.URL
|
||||
}
|
||||
|
||||
// MessageRow is one chat message in the moderation list: its sender (linked to the user
|
||||
// card), source, IP, body, game (linked to the game card) and time.
|
||||
// card), source, IP, body, game (linked to the game card), time, and whether it is still
|
||||
// unread by at least one recipient.
|
||||
type MessageRow struct {
|
||||
ID string
|
||||
SenderID string
|
||||
@@ -108,6 +110,32 @@ type MessageRow struct {
|
||||
Body string
|
||||
GameID string
|
||||
CreatedAt string
|
||||
Unread bool
|
||||
}
|
||||
|
||||
// ChatMessageDetailView is one chat message with its per-seat read breakdown, for the
|
||||
// console message card.
|
||||
type ChatMessageDetailView struct {
|
||||
ID string
|
||||
GameID string
|
||||
SenderID string
|
||||
SenderName string
|
||||
Source string
|
||||
Kind string
|
||||
Body string
|
||||
IP string
|
||||
CreatedAt string
|
||||
Unread bool
|
||||
Seats []ChatSeatStatusRow
|
||||
}
|
||||
|
||||
// ChatSeatStatusRow is one seat's read status on the message card: the seat index, the
|
||||
// occupant (linked to the user card) and its role ("sender", "read" or "unread").
|
||||
type ChatSeatStatusRow struct {
|
||||
Seat int
|
||||
AccountID string
|
||||
DisplayName string
|
||||
Role string
|
||||
}
|
||||
|
||||
// UserDetailView is one account with its stats, identities and recent games.
|
||||
|
||||
Reference in New Issue
Block a user