356f490546
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 11s
CI / ui (pull_request) Successful in 32s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m14s
A new /_gm/messages console page lists posted chat messages (nudges excluded) newest-first — time, source (guest/robot/oldest identity kind), sender (linked to the user card), IP, body, game (linked to the game card) — searchable by sender name / external-id glob masks and pinnable to one game (?game=) or sender (?user=), linked from the game and user cards. The list query lives in social (raw SQL, kind='message', source via a SQL CASE), reusing the now-exported account.LikePattern. Server-rendered adminconsole MessagesView + messages.gohtml, 50/page via the shared pager. Tests: adminconsole render case; backend integration AdminListMessages (real Postgres) — nudge exclusion, game/sender pins, glob masks, source. Docs: ARCHITECTURE section 8 chat moderation, PLAN round-6.
38 lines
1.5 KiB
Go Template
38 lines
1.5 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 (* ?)">
|
|
<button type="submit">Filter</button>
|
|
</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>Game</th></tr></thead>
|
|
<tbody>
|
|
{{range .Items}}
|
|
<tr>
|
|
<td>{{.CreatedAt}}</td>
|
|
<td>{{.Source}}</td>
|
|
<td><a href="/_gm/users/{{.SenderID}}">{{.SenderName}}</a></td>
|
|
<td>{{.IP}}</td>
|
|
<td>{{.Body}}</td>
|
|
<td><a href="/_gm/games/{{.GameID}}">game</a></td>
|
|
</tr>
|
|
{{else}}
|
|
<tr><td colspan="6"><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}}
|