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

Fix duplicate entry error when add team member #19702

Merged
merged 1 commit into from May 14, 2022
Merged

Fix duplicate entry error when add team member #19702

merged 1 commit into from May 14, 2022

Conversation

zuzuviewer
Copy link
Contributor

@zuzuviewer zuzuviewer commented May 14, 2022

Fix duplicate entry error when add a team member(#19697)

@@ -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 {
Copy link
Member

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.

Copy link
Member

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

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 14, 2022
@lafriks lafriks added this to the 1.17.0 milestone May 14, 2022
Copy link
Contributor

@zeripath zeripath left a 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

@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 May 14, 2022
@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 May 14, 2022
@lafriks lafriks merged commit 77e9346 into go-gitea:main May 14, 2022
@zuzuviewer zuzuviewer deleted the 19697 branch May 14, 2022 15:03
zjjhot added a commit to zjjhot/gitea that referenced this pull request May 14, 2022
* giteaofficial/main:
  Fix duplicate entry error when add team member (go-gitea#19702)
  [Refactor] convert team(s) to apiTeam(s) (go-gitea#13745)
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this pull request Aug 24, 2022
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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.

None yet

5 participants