Skip to content
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

Adjust username change cost #11809

Merged
merged 7 commits into from
Jan 23, 2025

Conversation

notbakaneko
Copy link
Collaborator

@notbakaneko notbakaneko commented Jan 22, 2025

closes #11790

The new logic is the price goes up 1 tier for every paid change, and down 1 tier for every year since the last paid change, to a minimum of 1.

@notbakaneko notbakaneko self-assigned this Jan 22, 2025
@notbakaneko notbakaneko force-pushed the feature/username-change-cost-update branch from e5c3a50 to 3f281e1 Compare January 22, 2025 09:49
@notbakaneko notbakaneko force-pushed the feature/username-change-cost-update branch from 3f281e1 to 965310b Compare January 22, 2025 09:49

UsernameChangeHistory::factory()->state(['type' => $type, 'user_id' => $user])->create();

$this->assertSame($user->usernameChangeCost(), $cost);
Copy link
Collaborator

Choose a reason for hiding this comment

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

the function signature is $expected, $actual so it should be $cost, $user->... here (and the rest of this file).

@nanaya nanaya enabled auto-merge January 23, 2025 06:51
@nanaya nanaya merged commit 89b2f71 into ppy:master Jan 23, 2025
3 checks passed
@Phippe
Copy link
Contributor

Phippe commented Jan 23, 2025

Once someone has changed their name 5 times or more, the default cost will be $100.

Now assume they wait for 4 years and then pay $8 for another name change. Shortly afterwards, they want to change their name again, but - if I understand the code correctly - now the price is back up to $100, not $16.

When I first read the proposal, I interpreted the cooldown to be more "permanent". Like once you've waited long enough, you would start at tier 1 again and then "work your way back up" for each name change after that.

I just wanted to ask if this is the intended behaviour.

Edit: After thinking a bit about how I'd implement this, it's probably just unnecessarily difficult for the handful of people that are affected by that, so should be fine.

@nanaya
Copy link
Collaborator

nanaya commented Jan 23, 2025

yeah I think it's an oversight. A simpler logic would probably be to just set the tier to be the number of name changes over the last 4-5 years. @notbakaneko

@notbakaneko notbakaneko deleted the feature/username-change-cost-update branch January 24, 2025 03:58
@peppy
Copy link
Member

peppy commented Jan 24, 2025

I guess we should wait for the oversight to be addressed before deploying to stop people getting confused.

@notbakaneko
Copy link
Collaborator Author

After going through it again, it's a lot more complicated to handle if the cost tier gets 'reset' to a new level each time.
Consider the case where the username is changed once a year:
If you go to the highest tier then the cost is $100 (tier 5), after a year the price drops to $64 (tier 4) moving the next change to tier 5 but if you wait a year again, it drops to tier 4.
The same applies to the other tiers where it'll just stay the same price if you wait a year before every change.
The $8 tier also requires an exception for handling it since it can't go below $8.

It doesn't seem practical without going through every username change in the user's history and calculating the current tier the name change should put it at, or storing the current tier.

I think it might make more sense if it was based on username changes in the past X years and maybe a reduction based on when the last change was made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Change the way name changes are priced
4 participants