aaac816dc2
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.
41 lines
1.8 KiB
Go Template
41 lines
1.8 KiB
Go Template
{{define "content" -}}
|
|
<h1>Messages</h1>
|
|
{{with .Data}}
|
|
<form class="form" method="get" action="/_gm/messages">
|
|
{{if .GameID}}<input type="hidden" name="game" value="{{.GameID}}">{{end}}
|
|
{{if .UserID}}<input type="hidden" name="user" value="{{.UserID}}">{{end}}
|
|
<input name="name" value="{{.NameMask}}" placeholder="sender name mask (* ?)">
|
|
<input name="ext" value="{{.ExtMask}}" placeholder="sender external id mask (* ?)">
|
|
<label class="check"><input type="checkbox" name="unread" value="1"{{if .UnreadOnly}} checked{{end}}> unread only</label>
|
|
<button type="submit">Filter</button>
|
|
<a class="export" href="/_gm/messages.csv?{{.FilterQuery}}">Export CSV ↓</a>
|
|
</form>
|
|
{{if or .GameID .UserID}}
|
|
<p class="note">Filtered{{if .GameID}} to game <a href="/_gm/games/{{.GameID}}">{{.GameID}}</a>{{end}}{{if .UserID}} from <a href="/_gm/users/{{.UserID}}">sender</a>{{end}} · <a href="/_gm/messages">clear</a></p>
|
|
{{end}}
|
|
<table class="list">
|
|
<thead><tr><th>Time</th><th>Source</th><th>Sender</th><th>IP</th><th>Message</th><th>Read</th><th>Game</th></tr></thead>
|
|
<tbody>
|
|
{{range .Items}}
|
|
<tr>
|
|
<td><a href="/_gm/messages/{{.ID}}">{{.CreatedAt}}</a></td>
|
|
<td>{{.Source}}</td>
|
|
<td><a href="/_gm/users/{{.SenderID}}">{{.SenderName}}</a></td>
|
|
<td>{{.IP}}</td>
|
|
<td>{{.Body}}</td>
|
|
<td>{{if .Unread}}unread{{else}}read{{end}}</td>
|
|
<td><a href="/_gm/games/{{.GameID}}">game</a></td>
|
|
</tr>
|
|
{{else}}
|
|
<tr><td colspan="7"><span class="note">no messages</span></td></tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
<nav class="pager">
|
|
{{if .Pager.HasPrev}}<a href="/_gm/messages?{{.FilterQuery}}&page={{.Pager.PrevPage}}">« prev</a>{{end}}
|
|
<span>page {{.Pager.Page}} · {{.Pager.Total}} total</span>
|
|
{{if .Pager.HasNext}}<a href="/_gm/messages?{{.FilterQuery}}&page={{.Pager.NextPage}}">next »</a>{{end}}
|
|
</nav>
|
|
{{end}}
|
|
{{- end}}
|