Skip to content

Fix bug when updating user email#36058

Merged
lunny merged 2 commits into
go-gitea:mainfrom
lunny:lunny/fix_admin_edit_user_email
Dec 1, 2025
Merged

Fix bug when updating user email#36058
lunny merged 2 commits into
go-gitea:mainfrom
lunny:lunny/fix_admin_edit_user_email

Conversation

@lunny
Copy link
Copy Markdown
Member

@lunny lunny commented Nov 29, 2025

Fix #20390

We should use ReplacePrimaryEmailAddress instead of AdminAddOrSetPrimaryEmailAddress when modify user's email from admin panel. And also we need a database transaction to keep deletion and insertion succeed at the same time.

@lunny lunny added type/bug backport/v1.25 This PR should be backported to Gitea 1.25 labels Nov 29, 2025
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 29, 2025
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Dec 1, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Dec 1, 2025
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Dec 1, 2025
@lunny lunny enabled auto-merge (squash) December 1, 2025 23:25
@lunny lunny merged commit 5340db4 into go-gitea:main Dec 1, 2025
23 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Dec 1, 2025
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Dec 1, 2025
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Dec 2, 2025
Fix go-gitea#20390 

We should use `ReplacePrimaryEmailAddress` instead of
`AdminAddOrSetPrimaryEmailAddress` when modify user's email from admin
panel. And also we need a database transaction to keep deletion and
insertion succeed at the same time.
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Dec 2, 2025
silverwind pushed a commit that referenced this pull request Dec 2, 2025
Backport #36058 by @lunny

Fix #20390 

We should use `ReplacePrimaryEmailAddress` instead of
`AdminAddOrSetPrimaryEmailAddress` when modify user's email from admin
panel. And also we need a database transaction to keep deletion and
insertion succeed at the same time.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@wxiaoguang wxiaoguang deleted the lunny/fix_admin_edit_user_email branch December 2, 2025 03:21
@wxiaoguang
Copy link
Copy Markdown
Contributor

wxiaoguang commented Dec 2, 2025

I have some questions about this change:

  1. AdminAddOrSetPrimaryEmailAddress is still called by API's "EditUser" PATCH /admin/users/{username}
    • Why the API doesn't get the fix?
  2. What's wrong with "AdminAddOrSetPrimaryEmailAddress"?
    • If it is not fixable, you need to remove it.
    • If it is fixable, you need to fix it and add tests.

zjjhot added a commit to zjjhot/gitea that referenced this pull request Dec 2, 2025
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  Fix bug when updating user email (go-gitea#36058)
  Add "Go to file", "Delete Directory" to repo file list page (go-gitea#35911)
  Replace `lint-go-gopls` with additional `govet` linters (go-gitea#36028)
  Fix Actions `pull_request.paths` being triggered incorrectly by rebase (go-gitea#36045)
silverwind added a commit to silverwind/gitea that referenced this pull request Dec 2, 2025
* origin/main:
  [skip ci] Updated translations via Crowdin
  Fix bug when updating user email (go-gitea#36058)
  Add "Go to file", "Delete Directory" to repo file list page (go-gitea#35911)
  Replace `lint-go-gopls` with additional `govet` linters (go-gitea#36028)
  Fix Actions `pull_request.paths` being triggered incorrectly by rebase (go-gitea#36045)
  Fix error handling in mailer and wiki services (go-gitea#36041)
  Update JS deps, fix deprecations (go-gitea#36040)
  Fix incorrect viewed files counter if file has changed (go-gitea#36009)
silverwind pushed a commit that referenced this pull request Dec 4, 2025
Follow #36058 for API edit user bug when editing email.

- The Admin Edit User API includes a breaking change. Previously, when
updating a user with an email from an unallowed domain, the request
would succeed but return a warning in the response headers. Now, the
request will fail and return an error in the response body instead.
- Removed `AdminAddOrSetPrimaryEmailAddress` because it will not be used
any where.

Fix #36058 (comment)

---------

Co-authored-by: Giteabot <teabot@gitea.io>
GiteaBot added a commit to GiteaBot/gitea that referenced this pull request Dec 4, 2025
Follow go-gitea#36058 for API edit user bug when editing email.

- The Admin Edit User API includes a breaking change. Previously, when
updating a user with an email from an unallowed domain, the request
would succeed but return a warning in the response headers. Now, the
request will fail and return an error in the response body instead.
- Removed `AdminAddOrSetPrimaryEmailAddress` because it will not be used
any where.

Fix go-gitea#36058 (comment)

---------

Co-authored-by: Giteabot <teabot@gitea.io>
silverwind pushed a commit that referenced this pull request Dec 4, 2025
Backport #36068 by @lunny

Follow #36058 for API edit user bug when editing email.

- The Admin Edit User API includes a breaking change. Previously, when
updating a user with an email from an unallowed domain, the request
would succeed but return a warning in the response headers. Now, the
request will fail and return an error in the response body instead.
- Removed `AdminAddOrSetPrimaryEmailAddress` because it will not be used
any where.

Fix #36058 (comment)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@xnox xnox mentioned this pull request Dec 7, 2025
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Mar 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/done All backports for this PR have been created backport/v1.25 This PR should be backported to Gitea 1.25 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The user's home page pointed to in the commit message is wrong

5 participants