Enable Public Press chat during staging (backend) - #1007
Conversation
Relax the game-status permission on ChannelListView, ChannelMessageCreateView, and ChannelMarkReadView to also allow PENDING games, so Public Press doubles as the staging lobby. ChannelCreateView is unchanged, so private channels still only exist once a game is active. Make ChannelMemberSerializer.nation nullable to represent nation-less staging members, and add an optional write-only intro_message field to the join endpoint that posts an intro to Public Press in the same transaction as the member row. The intro is skipped for no-press and anonymous games, where messaging is unavailable or the sender would show as "Anonymous". Closes #902 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FNnnB9Xzp3KRRAAjdwYoco
✅ Deploy Preview for diplicity-variant-creator canceled.
|
johnpooch
left a comment
There was a problem hiding this comment.
PR Review
This PR correctly implements staging chat per #902: the new IsActiveCompletedOrPendingGame permission is applied consistently across list/create/mark-read views, ChannelMemberSerializer.nation is properly nullable, frontend fallbacks to display name are correct and match the existing #808080 fallback-color convention, and the IsNotNoPressActiveGame/sandbox-join exclusions correctly stay blocking (sandbox games are always created pre-filled and active, so the join path is unreachable there anyway). Traced public_channels[0] — safe, since only one public (non-private) channel is ever created per game across the codebase. One suggestion found regarding a description/implementation mismatch around transactional atomicity of the join + intro-message write.
1 inline comment(s) (0 blocking, 1 suggestion).
Generated by Claude Code
Member/ChannelMember creation and the intro ChannelMessage were three independent commits without this, so a failure on the last write left the user joined with no intro posted. Matches GameCreateSerializer's existing pattern for analogous multi-step writes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FNnnB9Xzp3KRRAAjdwYoco
…rmission Per review: the intro message is better handled as two chained frontend requests (join, then post to Public Press) rather than a dedicated write-only field on the join endpoint, since it keeps message creation to a single endpoint. Reverts member/serializers.py and member/views.py to their pre-PR shape; the permission relaxation already makes posting to Public Press during staging possible for a joined member. Also removes IsActiveCompletedOrPendingGame: it checked for every GameStatus value, so it always evaluated true and gated nothing. ChannelListView, ChannelMessageCreateView, and ChannelMarkReadView no longer carry a game-status permission at all — nothing in this PR needs one. Added a CLAUDE.md guideline against adding permission classes like this in the future. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FNnnB9Xzp3KRRAAjdwYoco
…y7xk # Conflicts: # CLAUDE.md
|
This pull request has been inactive for 7 days and will be closed in 7 days unless there is further activity. If it is still being worked on, push a commit or leave a comment. Add the |
|
Still ready for review — CI is green and up to date with Generated by Claude Code |
|
This pull request has been inactive for 7 days and will be closed in 7 days unless there is further activity. If it is still being worked on, push a commit or leave a comment. Add the |
…y7xk # Conflicts: # packages/web/src/api/generated/endpoints.ts
What this PR does
Makes Public Press usable during staging (pending games), per #902: joined players can post, and anyone who can see the game can read — no new Lobby channel, Public Press doubles as the lobby.
ChannelMessageCreateViewandChannelMarkReadViewno longer carry a game-status permission (onlyIsGameMember/IsChannelMemberetc.);ChannelListViewusespermissions.AllowAny. None of the three needs to restrict by game status —ChannelCreateViewis untouched, so private channels still only exist once a game is active.ChannelMemberSerializer.nationis now nullable, since staging members have no nation assigned yet. The two chat screens (ChannelScreen,ChannelListScreen) that readsender.nation.namenow fall back to the member's display name when nation is null.openapi-schema.yamland the frontend TS client for the nullablenationfield.Out of scope, per review: an optional intro-message-on-join feature was cut from this PR in favor of a simpler two-chained-request frontend approach (join, then post to Public Press) in a follow-up.
Closes #902
Checklist
/review-pragainst this PR in Claude Code and addressed (or responded to) its findings — thegh-CLI-based skill isn't available in this sandbox, so I performed an equivalent manual read-through of the diff instead, and separately addressed human review comments.