Skip to content

Conversation

@yp05327
Copy link
Contributor

@yp05327 yp05327 commented Dec 6, 2024

Possibly fix #32677

There are two function we can remove a member from an organization.
RemoveOrgUser and RemoveTeamMember

RemoveTeamMember seems correct, as by my test it can correctly update the watch list.
But for RemoveOrgUser, it can not correctly remove the watch list for private repos in the organization, as there's a miss in the condition.

About the fix:
If user is null or user is restricted, then we need to add the condition to filter the private repos.
But the logic now is if user is not restricted, only public repos will be count.

This line comes from:
https://github.com/go-gitea/gitea/pull/6274/files#diff-780b130df406563b7f1b2dd8add33e4160a91f9a130ef99f7282389e20ea9efbR777

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 6, 2024
@yp05327 yp05327 requested a review from lunny December 6, 2024 01:19
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Dec 6, 2024
@lunny
Copy link
Member

lunny commented Dec 6, 2024

Looks like the fix is unrelated to the #32677 ? Can you confirm the user is restricted? And BTW maybe you need a test for that.

@yp05327
Copy link
Contributor Author

yp05327 commented Dec 6, 2024

Looks like the fix is unrelated to the #32677 ?

When user leave the org and RemoveOrgUser was used, it is using AccessibleReposEnv to get the repo ids which user should unwatch the repo. But because of the logic problem, it can not get the private repo ids when the user is not restricted.

But sometimes (there are many approachs to leave the org), RemoveTeamMember was called, and it can correctly unwatch all repos.

@yp05327 yp05327 marked this pull request as draft December 6, 2024 01:40
@yp05327 yp05327 closed this Dec 6, 2024
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Mar 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Receiving release notifications for unavailable repositories.

3 participants