Enable Public Press chat during staging - #1009
Conversation
Relax the game-status permission on ChannelListView, ChannelMessageCreateView, and ChannelMarkReadView so pending games behave like active ones: joined members can post, and anyone who can see the game can read. Public Press doubles as the staging lobby, per the issue discussion - no new channel type. Make ChannelMemberSerializer.nation nullable so messages from staging members (who have no nation yet) serialize correctly, and add an optional intro_message field to the join endpoint that posts to Public Press in the same transaction as the member row, when the game supports chat (not sandbox/no-press/anonymous). Closes #902 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016a4jiSeAknweYjEUy7Es4p
- Skip the bot-reply signal for non-active games: enabling staging chat means a human message in a pending game with a bot member (added via BotMemberCreateView) now reaches bot.signals.reply, which always failed its order-options fetch (403, game not active) and logged noise for every message. Regression test added. - Simplify MemberSerializer.create(): drop the unreachable "not game.sandbox" guard (sandbox games are never PENDING, so this endpoint never sees one) and match the public channel by the private=False filter alone instead of a hardcoded "Public Press" name lookup. - Extract getSenderDisplayName/DEFAULT_NATION_COLOR into channelUtils so the null-nation fallback isn't copy-pasted across ChannelScreen and ChannelListScreen. - Add test coverage the null-nation rendering path and the intro-message bot cap/whitespace edge cases were missing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016a4jiSeAknweYjEUy7Es4p
|
Warning WIP limit exceeded. There are now 7 open pull requests — the project target is 5 or fewer. Please close or merge an existing PR before continuing with this one. |
✅ Deploy Preview for diplicity-variant-creator canceled.
|
Staging Environment DeployedFrontend preview: https://deploy-preview-1009--diplicity-react.netlify.app The staging backend has a copy of the production database from the daily snapshot taken at Tue, 07 Jul 2026 06:04:12 GMT, with migrations from this PR applied. The frontend preview derives its backend URL from the PR number at build time. |
|
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 active — CI is green (test/build/lint all pass) and this is labeled 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 |
Resolves conflicts from the bot-app split (#1045): service/bot/tests.py was deleted upstream in favor of service/agent/tests.py, so the new pending-game reply-guard test moved there. member/tests.py had a plain import-path conflict (bot.models -> bot_profile.models). Git's rename-aware merge already carried the game-status guard from bot/decorators.py onto the new agent/decorators.py without a conflict. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016a4jiSeAknweYjEUy7Es4p
…commit Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016a4jiSeAknweYjEUy7Es4p
What this PR does
Makes Public Press usable before a game starts: joined members can post, anyone who can see the game can read, and an optional intro message is collected on join. Public Press doubles as the staging lobby — no new channel type, per the decision recorded on the issue.
ChannelListView,ChannelMessageCreateView, andChannelMarkReadViewno longer require an active/completed game — a member of a pending game can now list, post to, and mark read the game's channels.ChannelCreateViewis untouched (private channels stay active-game-only, since naming them requires assigned nations).ChannelMemberSerializer.nationis now nullable, since staging members have no nation yet.MemberSerializer(the join endpoint) gains an optional, write-onlyintro_messagefield. When provided, it's posted to Public Press in the same transaction as the member row — skipped for no-press and anonymous games (chat is unavailable or the sender would show as "Anonymous"). Making this required is deliberately deferred to a follow-up PR so it can be verified and reverted independently.ChannelListScreen,ChannelScreen) fall back to the sender's name/a neutral color whennationis null, so existing chat rendering doesn't break once the schema changes.One incidental fix: enabling staging chat means a human message in a pending game with a bot member (bots can be added to a game before it starts via
BotMemberCreateView) now reaches the bot's reply signal, which always failed its order-options fetch (403 — game isn't active) and logged an error for every message. Added a guard so the bot only attempts a reply in active games, plus a regression test.Screenshots aren't included — the changed rendering path (a staging-chat message with no nation yet) isn't reachable through the app's current navigation, since pending games don't route to the chat screen until #903/#906 land. It's covered by component tests instead.
Closes #902
Generated by Claude Code