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

User badge model fixes for RemoveUserBadges and AddUserBadges #33950

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

komarov
Copy link

@komarov komarov commented Mar 20, 2025

Fixes #33949

RemoveUserBadges implementation is fixed to avoid an ORM construct that produced invalid SQL (see the referenced issue for details).

AddUserBadges won't be able to produce duplicate badges anymore due to a unique constraint added to the user_badge table. An attempt to add a duplicate badge will result in an error.
The corresponding database migration is supposed to delete any potential badge duplicates existing before.

A new test is added to demonstrate these fixes.

Oleg Komarov added 7 commits March 14, 2025 12:51
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 20, 2025
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 20, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/migrations labels Mar 20, 2025
@lunny lunny requested a review from techknowlogick March 20, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code modifies/migrations size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User badges model: RemoveUserBadges is broken and AddUserBadges creates duplicates
2 participants