-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Add support for pronouns #35306
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
Add support for pronouns #35306
Conversation
Closes #13990 Disclaimer: This commit contains code from Forgejo, but is from a pull request that pre-dates the switch to the GPLv3 license.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for submitting a PR for this. Usually, a new field on a struct would require a new migration, however since we are trying to limit the number of new columns added to common tables (such as user), the approach described in the ticket for this would be to use the user_settings table, and store/fetch the data from there (if key/row doesn't exist for a user, then we can treat it as not being set, otherwise we can use the value).
You can see an example of the user_settings table in use here:
Lines 155 to 160 in 57b8441
| type Meta struct { | |
| // Store the initial registration of the user, to aid in spam prevention | |
| // Ensure that one IP isn't creating many accounts (following mediawiki approach) | |
| InitialIP string | |
| InitialUserAgent string | |
| } |
https://github.com/go-gitea/gitea/blob/main/models/user/user.go#L774-L788
|
Most of the code in this PR is from https://codeberg.org/forgejo/forgejo/pulls/1518, more precisely patches 1 and 20, for future reference. |
|
It appears that much of the similar user information is stored in Consider rereviewing this. |
|
I've also tested this code by upgrading from the latest stable Gitea to this patched version, and it appears no form of migration was needed. By default no users have pronouns, and each one can manually add their own just fine. |
|
In theory this should be as seamless as the location feature, which has existed for many years, and I'm not aware of any complaints because it was added. |
But then the table will continue to grow larger and larger. All non-indexed columns can be stored in user_settings, which avoids the need for migrations. Migrations are only required when introducing a new column. Otherwise, upgrades from older versions would break. |
Closes #13990
Disclaimer: This commit contains code from Forgejo, but is from a pull request that pre-dates the switch to the GPLv3 license.