-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix duplicate entry error when add team member #19702
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
Conversation
@@ -496,6 +496,12 @@ func AddTeamMember(team *organization.Team, userID int64) error { | |||
} | |||
defer committer.Close() | |||
|
|||
// check in transaction | |||
isAlreadyMember, err = organization.IsTeamMember(ctx, team.OrgID, team.ID, userID) | |||
if err != nil || isAlreadyMember { |
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.
But err
is nil
when isAlreadyMember
is true.
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.
it will return nil than, this should be fine
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.
Realistically this all needs to be in a single transaction but will work
* giteaofficial/main: Fix duplicate entry error when add team member (go-gitea#19702) [Refactor] convert team(s) to apiTeam(s) (go-gitea#13745)
Fix duplicate entry error when add a team member(#19697)