-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Bug fix allow users with access to count as official reviewers #31886
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
Bug fix allow users with access to count as official reviewers #31886
Conversation
Gitea code-base has the concept of "official reviewer", but how it is counted is pretty inconsistent and confusing the UI. Before:
So, what is the purpose of "official reviewers"? Can we simply get rid of this and count all reviews toward approvals? The changes here reduce the requirement for CODE from "write" to "read". Can someone still leave a review with PullRequest "read" permission and no CODE permission? If so, I don't think this PR fully solves the problem. Further, there seems to be an issue of communication. If a user adds branch-protection with users specifically in allow-list do they see the same thing here? It seems we need to communicate in the PR page why someone is/isn't counting towards reviews. I believe github will either give a "green" check or a "grey" check based on their permissions. Any other ideas how we can simplify & communicate this? I'm always a fan of tooltips. |
I think this is by design. Maybe we need docs to explain it. |
What's the intended case for it? |
If anyone's approvals should be count, then there's no meaning of branch protection rules. |
Thanks for considering and explaining. It's strange logic to me that we allow someone to review (and get a green checkbox), but then not count them as a "approver". And certainly needs to be explained better in the application (note that the original proposal would change the wording to " 0 of 1 approvals granted from reviewers with write access", but that change was not implemented). I propose one of the following two options:
Either way, I think we need to change the UI to indicate the following:
I believe we cannot expect all users to go read the documentation for typical use cases and anything that can be explained in the app at the time of need should be. What do you think @yp05327 |
@kdumontnu The changes you outlined to make the UI more intuitive are clear and make sense. I'll get working on those enhancements. |
I partly agree with your suggestions.
And
And
I agree. And maybe the colors can be changed for different roles?
If we don't implement the second one, for the first one only, then maybe it is acceptable.
If users with read permission can not review, then how about left a simple comment (not a review) ?
I agree. These contents should be changes, but not only in this place, but also in the branch rules settings page.
Any more details about this change? Is it only rename, or we need to change the logic? Summary: Maybe we need @go-gitea/technical-oversight-committee 's advices. |
Anyway, I'll block this PR until other TOC agree to break the current design. |
@yp05327 @wolfogre Thanks, I think we agree for the most part. To be clear: I only suggest one of those two options, not both. Both involve getting rid of "official reviewer". I think the concept of "Official Reviewer" is really confusing when you also consider all of the repo units. Part of the reason I was so confused is that there are Pull Request "Read", Pull Request "Write", but Official Review requires repo "Write" in addition (otherwise you will be silently ignored) 🤯 If all that comes out of this is improving the in-app UI for explaining this then that's a good start - I definitely won't block improvements. However, I feel strongly about abolishing "official reviewers" to simplify permissions (and there are other ways to achieve higher repo protections). Regarding GitHub - I think many things GitHub does are very confusing 😆. I had no idea about GitHub's official reviewers until now. |
PR with UI changes opened here: #31924 |
Why do we need to store the official reviewer in the database someone may not be an official reviewer anymore. He maybe leave one team to another team. But we need to keep the original situation when he approved that PR. |
Good point. That functionality can remain the same. The change here is just regarding permissions. |
Why a person can read the code could approve the code change? At least, it's impossible for open-source projects like Gitea. Also for those internal repositories shared with all persons in a company, it's also not a good practice. |
Can you please read my analysis here? #31886 (comment) I have explained these points and suggestions moving forward. |
@lunny since I suspect you will not ready my analysis, I will summarize here:
Either of the two solutions should cover the case you mentioned while simplifying permissions. |
|
I'm not sure what you're saying here. |
Maybe add an option in repo settings to allow it is the best solution. |
It's a good idea and an understandable conclusion, but I would rather not make a change here than add another setting. There are too many settings already & our goal here is to remove one permutation, not add another. |
#31924) This Pull Request is a follow up to #31886: 1. Adds a UI indicator between official (green) and unofficial (grey) approved pull requests on the Pull Request page (as suggested by @kdumontnu ) 2. Adds tooltips adding clarity to the type and status of a review on the Pull Request page (as suggested by @kdumontnu) 3. Updates text adding more clarity to required approvals (as suggested by @kdumontnu) 4. Updates text on the branch settings page explaining what branch approval limitations (as suggested by @yp05327) Official approval: <img width="376" alt="Screenshot 2024-08-26 at 1 03 52 PM" src="https://github.com/user-attachments/assets/500f083d-bfc0-45c5-82b7-b98e20495696"> Unofficial approval: <img width="442" alt="Screenshot 2024-08-26 at 12 53 15 PM" src="https://github.com/user-attachments/assets/e8c565ff-5886-4ce1-8b79-a0fa26c282f7"> Rejected approval: <img width="452" alt="Screenshot 2024-08-26 at 12 53 06 PM" src="https://github.com/user-attachments/assets/aebc0e2f-7052-4dea-8098-7caa0db86617"> Stale approval: <img width="546" alt="Screenshot 2024-08-26 at 1 07 59 PM" src="https://github.com/user-attachments/assets/da599ff3-e35c-4fa3-8141-ed80b738dd77"> Requested review tooltip: <img width="434" alt="Screenshot 2024-08-26 at 12 53 22 PM" src="https://github.com/user-attachments/assets/460d163e-8724-43b6-8760-34b285da8fe2"> Updated text for approvals: <img width="991" alt="Screenshot 2024-08-26 at 12 54 00 PM" src="https://github.com/user-attachments/assets/ab3ff012-9742-4c1b-933d-21addcb89f2c"> Updated text for allowlisted/whitelisted approvals: <img width="990" alt="Screenshot 2024-08-26 at 1 01 40 PM" src="https://github.com/user-attachments/assets/1a5bae61-d9e0-4d96-b86f-92610b0940d1"> Protected branch settings text: <img width="1022" alt="Screenshot 2024-08-26 at 1 01 14 PM" src="https://github.com/user-attachments/assets/892ce208-e1c2-41f7-8fec-46d5a0e7e776"> Comments list: <img width="1048" alt="Screenshot 2024-08-28 at 9 25 31 AM" src="https://github.com/user-attachments/assets/9c5c00c5-06cf-43b3-b413-4f7f673609b2"> --------- Co-authored-by: Kyle D. <kdumontnu@gmail.com>
Closing this Pull Request. The project decided that only users and teams with write access should have the ability to count towards the required PR reviews on the protected branches. We were able to improve the user experience by adding frontend enhancements to allow users to distinguish between approvals that are official and those that are not official. That work was merged in PR 31924. |
This Pull Request fixes an issue where you can assign a user with only READ access as a reviewer, but their review does not count towards the minimum required approval count.
You can see an example of this here: https://demo.gitea.com/Witea1/PermissionsTest/pulls/1
Steps to reproduce:
Create a new organization
1a Keep default settings
Create a new repository
Create a branch protection
3a. Branch main
3b. 1 required approval
Create a “READ-ONLY” team with only access to read
4a. Set repository access to ‘All Repositories’
Add a non-admin user to the “READ-ONLY” team
In the repo you created for step 2, create a new pull request
Assign your user from the “READ-ONLY” team as a reviewer
Login as the user on the “READ-ONLY” team and approve the design review
Notice, you will still have “0 of 1” approvals granted and visible both from the “READ-ONLY” team member and from the admin user who created the design review.