Repository navigation
Privacy settings: hide my level, and keep my profile out of search engines #5771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
53b26e0
Show player levels and the XP each game earns
iiamlewis 6ff9abf
Strip Lit's comment markers in the badge tests as nodes, not by regex
iiamlewis c91fed6
Merge branch 'main' into player-levels-ui
iiamlewis 0ef94ba
Harden player levels UI from PR review
iiamlewis 23be312
Merge branch 'main' into player-levels-ui
iiamlewis b899cb0
Address review on player levels: unverified games, off-screen reveals…
iiamlewis 216851d
Rename the first-win XP line to first game of the day
iiamlewis a9c27cb
Recognise the new subscriber XP boosts: +25% / +50% / +100%
iiamlewis 399acf7
feat: stamp player levels onto the lobby roster
iiamlewis 0e2d49c
feat: show level badges in the lobby list and player panel
iiamlewis 4c24467
feat(server): leave the level badge off players who hide their level
iiamlewis ae66131
feat(client): a player who hides their level still sees their own badge
iiamlewis fbaea1f
feat(client): Privacy card in account settings to hide your level
iiamlewis bfbcbda
perf: benchmark the lobby roster's level badges
iiamlewis 91e13d6
fix(core): read a malformed levelHidden as absent
iiamlewis 08e0bfb
feat(client): "Show my profile in search engines" in the Privacy card
iiamlewis 46dd844
fix(client): a player who hides their level sees it on their own profile
iiamlewis 5f83874
Stack the XP reveal's counter and level progress on a narrow bar
iiamlewis 6a758f1
Show the XP a past game earned under its summary card
iiamlewis 2edf46b
perf: carry the roster's level badge as one packed integer
iiamlewis ad04ccf
Merge roster-levels (packed level badge) into level-optout
iiamlewis be3a39c
Merge level-optout (packed level badge) into search-optout
iiamlewis f6bf428
perf: draw a full lobby's level badges over a few frames
iiamlewis cc30999
Merge roster-levels (staggered badge fill) into level-optout
iiamlewis ed22293
Merge level-optout (staggered badge fill) into search-optout
iiamlewis c93e4b0
Merge main: src/core split into engine, engine-api and shared packages
iiamlewis 0a960f1
Merge player-levels-ui: src/core split into packages
iiamlewis 80705bc
Merge roster-levels: src/core split into packages
iiamlewis a19f39f
Merge level-optout: src/core split into packages
iiamlewis c1f80da
Merge remote-tracking branch 'origin/main' into player-levels-ui
iiamlewis d1ae378
Point the XP popup test at EventBus's new home in @openfront/shared
iiamlewis 88a6c74
Merge player-levels-ui: bring the branch up to date with main
iiamlewis fc73327
Merge remote-tracking branch 'origin/roster-levels' into level-optout
iiamlewis 95c86ba
Merge remote-tracking branch 'origin/level-optout' into search-optout
iiamlewis 1271d1f
Merge main: lazy-loaded homepage modals
iiamlewis 5ae7770
Hide my level: a malformed setting reads as hidden; say it takes a while
iiamlewis e225511
Merge level-optout (#5771 review fixes); a malformed searchHidden rea…
iiamlewis a22ad43
Privacy toggles: one write path for level and search visibility
iiamlewis 1f01c85
Honour "hide my level" on the roster badge; own badge after a refresh
iiamlewis 812cc15
Address review on the player levels UI
iiamlewis 049232e
Merge roster-levels (#5763 review fixes): the hide-my-level guard now…
iiamlewis c1b833f
Merge player-levels-ui (review fixes)
iiamlewis 9f571f5
Merge roster-levels (review fixes)
iiamlewis 667c87e
Merge level-optout (review fixes)
iiamlewis 0111c2c
Merge main (#5726 and #5778 landed)
iiamlewis 560c0a3
Merge roster-levels (main sync)
iiamlewis 84f746e
Merge level-optout (main sync)
iiamlewis 830c69d
Merge origin/main into level-optout
iiamlewis 6cffd4f
Keep the own-level fallback in step with the setting and the session
iiamlewis 1eaacc8
Pin levelBadge as ClientInfo's last field
iiamlewis 53ff155
Move the lobby badge perf harnesses to their own PR
iiamlewis 0bd325b
Merge branch 'level-optout' into search-optout
iiamlewis 61c86ac
Own level badge: only the latest refresh writes the cache
iiamlewis f50c230
Merge level-optout (own badge refresh order)
iiamlewis 8fba939
Merge origin/main into level-optout
iiamlewis 6180838
Merge level-optout into search-optout
iiamlewis d539cbb
Merge search-optout (#5779) into level-optout (#5771)
iiamlewis 9e663f5
Privacy settings: drop old-API fallbacks
iiamlewis d9443c5
Privacy settings: keep the guard for an API without the settings
iiamlewis afac379
Merge branch 'main' into level-optout
Celant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import type { UserMeResponse } from "@openfront/shared/ApiSchemas"; | ||
| import type { LevelBadge } from "@openfront/shared/LevelBadgeWire"; | ||
| import { getUserMe } from "./Api"; | ||
|
|
||
| // The viewer's OWN level badge while they hide their level ("hide my level"). | ||
| // | ||
| // The game server leaves a hidden player's badge off the lobby roster for | ||
| // everyone, the player included, but they still see their own level. So their | ||
| // client draws it from its own /users/@me instead — local only, nothing is | ||
| // sent anywhere. Undefined while the level is shown (the roster carries the | ||
| // badge then), for guests, and when progression is off. | ||
|
|
||
| export function ownHiddenLevelBadgeFrom( | ||
| me: UserMeResponse | false, | ||
| ): LevelBadge | undefined { | ||
| if (me === false || me.player.levelHidden !== true) return undefined; | ||
| const progress = me.player.progress; | ||
| if (progress === undefined) return undefined; | ||
| return { | ||
| level: progress.level, | ||
| prestige: progress.prestige, | ||
| legend: progress.legend, | ||
| }; | ||
| } | ||
|
|
||
| let cached: LevelBadge | undefined; | ||
| // Bumped by every refresh and when the session is cleared: only the latest | ||
| // refresh writes the cache. One still waiting on an older /users/@me (from | ||
| // before a visibility change, or the old account's after a clear) leaves it. | ||
| let generation = 0; | ||
|
|
||
| // The last value refreshOwnHiddenLevelBadge() found, for synchronous readers | ||
| // (the in-game player panel). | ||
| export function ownHiddenLevelBadge(): LevelBadge | undefined { | ||
| return cached; | ||
| } | ||
|
|
||
| // Re-reads it from /users/@me. getUserMe() is memoised, so this is normally | ||
| // answered from the profile already loaded at sign-in / join — no request. | ||
| export async function refreshOwnHiddenLevelBadge(): Promise< | ||
| LevelBadge | undefined | ||
| > { | ||
| const forGeneration = ++generation; | ||
| const badge = ownHiddenLevelBadgeFrom(await getUserMe()); | ||
| if (forGeneration === generation) cached = badge; | ||
| return cached; | ||
| } | ||
|
|
||
| document.addEventListener("session-cleared", () => { | ||
| generation++; | ||
| cached = undefined; | ||
| }); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.