-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Ensure user email is always in email address table #13296
Ensure user email is always in email address table #13296
Conversation
In order to avoid email duplication, ensure that once an user is created or updated his new email address is added to the email address table.
I don't think this can be backported anymore as there is migration |
…s-stored-in-email-address-table * origin/master: [UI] Hide consecutive additions and removals of the same label (go-gitea#13315) [skip ci] Updated translations via Crowdin Fix send mail (go-gitea#13312) [skip ci] Updated translations via Crowdin Deny wrong pull (go-gitea#13308) Group Label Changed Comments in timeline (go-gitea#13304) [skip ci] Updated translations via Crowdin Attempt to handle unready PR in tests (go-gitea#13305) go-gitea#12897 - add mastodon provider (go-gitea#13293) [skip ci] Updated translations via Crowdin Fix Storage mapping (go-gitea#13297) Update Mirror IsEmpty status on synchronize (go-gitea#13185) Fix bug isEnd detection on getIssues/getPullRequests (go-gitea#13299) systemd service: Add commented PATH environment option for Git prefix (go-gitea#13170) Sendmail command (go-gitea#13079) Various UI and arc-green fixes (go-gitea#13291)
…s-stored-in-email-address-table
…s-stored-in-email-address-table * origin/master: Remove obsolete change of email on profile page Fully remove fomantic-ui from frontend build dependencies Fix command-line doc examples
This reverts commit bdd4bc2.
This reverts commit 77cd657.
Update user email addresses as they are being used by other fixtures in the email_address.yml file, belonging to user1 and user2. And used in several tests, expecting to belong to them.
YES we can NOT backport migration, but this should go into doctor as task and the bugfix itselfe can be backported :) |
Finally, I was able to fix the fixtures that were causing errors in some unit + integration tests. It does need the migration, else users may be able to duplicate their email addresses. |
@@ -186,14 +186,14 @@ | |||
lower_name: user11 | |||
name: user11 | |||
full_name: User Eleven | |||
email: user11@example.com | |||
email: user011@example.com |
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.
why change ?
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.
Because in the email_1ddress.yml
fixtures, the user11@example.com
is registered to user1
, and changing that file rather than this, brings more issues and places where it should be updated (I initially went through that route with commits bdd4bc2 and 77cd657), and decided later that the minimal impact would be to update the email address here.
models/migrations/v158.go
Outdated
if err := x.Sync2(new(User), new(EmailAddress)); err != nil { | ||
return err | ||
} |
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.
I don't think it's necessary, because you haven't changeed the struct of them.
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.
Got it, my bad, just read some other migrations and I thought it was required.
In my opion, maybe it's not necessary to kept |
That was my original intention, as I removed the Email field from the User, havoc broke, as it is used in so many places that I reverted to better sync the fields in the user and email tables. This PR has the minimum to fix the issue, if a complete re-write of the User model is what is intended (or best), I think this should be closed then, as it will be a way bigger effort. |
…s-stored-in-email-address-table * origin/master: (42 commits) [skip ci] Updated translations via Crowdin Fix bug on release publisherid migrations [skip ci] Updated translations via Crowdin Fixed git args duplication [skip ci] Updated translations via Crowdin [Vendor] update macaron related Add the tag list page to the release page fix docker rootless manifest Refactor image paste code [skip ci] Updated translations via Crowdin Fix 'add code comment' button being invisible all the time Fix reactions on code comments Remove specific indexer path [skip ci] Updated translations via Crowdin Misc UI fixes, add secondary color Set auto-tag to false on rootless manifest Fix typo docker: rootless image don't append key file if asked not to Comment box tweaks and SVG dropdown triangles ...
Please resolve the conflicts. |
I'm not sure if actually solving the conflicts makes sense anymore. Probably, as it is very stale, it makes more sense to actually re-work it. I'm gonna close the PR and will open a new one later, whenever I get some free time. |
This PR solves the issue with duplicated emails reported in #11251, by ensuring that the primary user email address is in the email_address table too.
Fixes #11251.