Skip to content

Update lobby API to hide other player's clan tags in public games#3509

Open
andybellenie wants to merge 2 commits intoopenfrontio:mainfrom
andybellenie:hide-clan-tags-api
Open

Update lobby API to hide other player's clan tags in public games#3509
andybellenie wants to merge 2 commits intoopenfrontio:mainfrom
andybellenie:hide-clan-tags-api

Conversation

@andybellenie
Copy link
Copy Markdown

@andybellenie andybellenie commented Mar 24, 2026

Resolves #3496

Description:

Hides the clan tag from the broadcastLobbyInfo() API unless the tag matches your own.

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

andystrangelove

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 24, 2026

Walkthrough

Updated broadcastLobbyInfo() to send per-recipient game information instead of a shared snapshot. Added a private gameInfoForClient() helper that filters client clan tags based on game visibility and whether the recipient's clan tag matches.

Changes

Cohort / File(s) Summary
Lobby Visibility Logic
src/server/GameServer.ts
Modified broadcastLobbyInfo() to call new gameInfoForClient() for each recipient. Helper clones game info and rewrites the clients list to show clan tags only when: game is private (always shown), or game is public and recipient's clan tag matches the client's clan tag. Broadcast loop structure remains unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🔐 A clan tag hides when strangers peek,
Your secret safe, your team unique,
No more sniping through the fog—
Each player sees their own true log.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: updating the lobby API to hide clan tags in public games.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose and linking to issue #3496 which defines the requirement.
Linked Issues check ✅ Passed The code changes implement the core requirement from #3496: hiding other players' clan tags in public games while preserving them in non-public games.
Out of Scope Changes check ✅ Passed All changes focus on the intended goal of the PR: modifying broadcastLobbyInfo() to send recipient-dependent clan tag data.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/server/GameServer.ts`:
- Around line 667-680: gameInfoForClient leaks clan tags in public lobbies
because rejoinClient/identityUpdate can change a client’s clanTag via censored
input; either stop revealing any clan tags for public games or prevent clanTag
changes after first join. Fix option A: in GameServer.gameInfoForClient(), when
this.gameConfig.gameType === GameType.Public always set each client.clanTag to
null (do not reveal recipient-specific matches). Fix option B: in the
rejoinClient / identityUpdate path, validate that a provided clanTag matches the
already-stored original clanTag (or reject changes) and only update clanTag if
the client has no prior clanTag; ensure censor() is not used to accept arbitrary
new tags. Update the logic in gameInfoForClient and/or rejoinClient accordingly
to reference gameInfoForClient, rejoinClient, identityUpdate, and censor.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e11bd878-a51b-43e5-8750-af4f0dbab7a3

📥 Commits

Reviewing files that changed from the base of the PR and between 4e126c2 and 8a60827.

📒 Files selected for processing (1)
  • src/server/GameServer.ts

@github-project-automation github-project-automation bot moved this from Triage to Development in OpenFront Release Management Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development

Development

Successfully merging this pull request may close these issues.

Hide clan tag from lobby screen to prevent tag sniping

1 participant