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

Distinguish official vs non-official reviews, add tool tips, and upgr… #31924

Merged
merged 11 commits into from
Sep 6, 2024

Conversation

william-allspice
Copy link
Contributor

@william-allspice william-allspice commented Aug 26, 2024

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:
Screenshot 2024-08-26 at 1 03 52 PM

Unofficial approval:
Screenshot 2024-08-26 at 12 53 15 PM

Rejected approval:
Screenshot 2024-08-26 at 12 53 06 PM

Stale approval:
Screenshot 2024-08-26 at 1 07 59 PM

Requested review tooltip:
Screenshot 2024-08-26 at 12 53 22 PM

Updated text for approvals:
Screenshot 2024-08-26 at 12 54 00 PM

Updated text for allowlisted/whitelisted approvals:
Screenshot 2024-08-26 at 1 01 40 PM

Protected branch settings text:
Screenshot 2024-08-26 at 1 01 14 PM

Comments list:
Screenshot 2024-08-28 at 9 25 31 AM

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 26, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 26, 2024
@github-actions github-actions bot added modifies/translation modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files labels Aug 26, 2024
@william-allspice william-allspice marked this pull request as ready for review August 26, 2024 18:20
func (r *Review) HTMLTypeColorName() string {
switch r.Type {
case ReviewTypeApprove:
if !r.Official {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I made the decision to prioritize the unofficial vs official indicator over stale. So an unofficial reviewer will not see a stale indication. To me, this made the most sense since seeing why a review doesn't count towards a protected branches approval limit felt more pertinent then seeing it was stale.

Let me know if you disagree with this logic.

@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 Aug 26, 2024
Copy link
Contributor

@kdumontnu kdumontnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestion - thanks!

@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 Aug 26, 2024
@yp05327
Copy link
Contributor

yp05327 commented Aug 26, 2024

In the code, it is whitelist, and for the UI, it is allowlist..... Just similar to activities, the naming has no consistency.
But as there are already two approves, maybe it is ok.

And another thing, it seems that you didn't changed the icon color here?
I think it is in templates/repo/issue/view_content/comments.tmpl, but there's no change in this PR.
ps: screenshot is copied from #31886 (comment)
image

@william-allspice
Copy link
Contributor Author

@yp05327 thank you for pointing out the discrepancy with the comment list.

The way the system exists today, an "official" review will become "unofficial" as soon as an approved user submits a second review. I'm not sure displaying a grey check mark for an official reviewers previous review makes sense. The tool tip would definitely not. As far as I can tell, the real use for the Official boolean is just to optimize a SQL count query here: https://github.com/go-gitea/gitea/blob/main/models/issues/pull.go#L384

Furthermore, we currently don't show a different color for stale reviews. You can see here, its either red or green (no yellow): https://github.com/go-gitea/gitea/blob/main/templates/repo/issue/view_content/comments.tmpl#L383 I'm not certain if that difference is intentional.

In my opinion, further modification of the official boolean feels out of scope for this change. But please let me know if you feel differently.

@kdumontnu
Copy link
Contributor

kdumontnu commented Aug 27, 2024

@yp05327 thank you for pointing out the discrepancy with the comment list.

The way the system exists today, an "official" review will become "unofficial" as soon as an approved user submits a second review. I'm not sure displaying a grey check mark for an official reviewers previous review makes sense. The tool tip would definitely not. As far as I can tell, the real use for the Official boolean is just to optimize a SQL count query here: https://github.com/go-gitea/gitea/blob/main/models/issues/pull.go#L384

I actually think this might be intended behavior (or at least acceptable). Once the user leaves a second review the previous one is no longer "official". It doesn't necessarily indicate the reviewer doesn't have sufficient permissions (for instance, if they approve, then reject, the previous approval doesn't count). I still think it's better than showing green for everyone.

Also, the other intention of official approver boolean was to continue to count the approval even if that user is removed from the project later (though, to be fair I'm not sure why someone would want this behavior).

@yp05327
Copy link
Contributor

yp05327 commented Aug 28, 2024

There are two tables. One is Review, and the other one is Comment.

The way the system exists today, an "official" review will become "unofficial" as soon as an approved user submits a second review.

This is recorded in Review table, and can only have one record. So it will be changed when user submits a second one.
Then what I said above, it is in Comment table, and can have several records. They are not the same thing.

Wait, comment saved the review id, not the details, so it will be changed...... IMO, this should not be changed for comments.
@lunny @wolfogre
How do you think about this.

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 28, 2024
@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 28, 2024
@kdumontnu
Copy link
Contributor

There are two tables. One is Review, and the other one is Comment.

The way the system exists today, an "official" review will become "unofficial" as soon as an approved user submits a second review.

This is recorded in Review table, and can only have one record. So it will be changed when user submits a second one. Then what I said above, it is in Comment table, and can have several records. They are not the same thing.

Wait, comment saved the review id, not the details, so it will be changed...... IMO, this should not be changed for comments. @lunny @wolfogre How do you think about this.

My thought here was that as soon as the user leaves an updated review, the previous one would change to grey (unofficial). This reflects the database state & should be pretty clear/intuitive. The "green" checks clearly indicate which reviews are being counted to the total. Grey can be because the user doesn't have sufficient permissions or because they have left a second/third review.

I think it would be much more confusing as it currently is, where I can "approve" and see a green check, then "reject" and have a red x - it's slightly ambiguous that my previous green check doesn't count toward approvals. Marking it grey helps imo.

Copy link
Contributor

@kdumontnu kdumontnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving additional review to reflect the latest changes.

@lunny
Copy link
Member

lunny commented Aug 28, 2024

There are two tables. One is Review, and the other one is Comment.

The way the system exists today, an "official" review will become "unofficial" as soon as an approved user submits a second review.

This is recorded in Review table, and can only have one record. So it will be changed when user submits a second one. Then what I said above, it is in Comment table, and can have several records. They are not the same thing.

Wait, comment saved the review id, not the details, so it will be changed...... IMO, this should not be changed for comments. @lunny @wolfogre How do you think about this.

That should be another issue/bug?

@yp05327
Copy link
Contributor

yp05327 commented Aug 29, 2024

That should be another issue/bug?

I don't think so.
The operation history (the comment mentioned above) should not be changed, but it can be changed now.
If a PR introduced a known bug before merge, I don't think it should be another bug/issue.

@william-allspice
Copy link
Contributor Author

That should be another issue/bug?

I don't think so. The operation history (the comment mentioned above) should not be changed, but it can be changed now. If a PR introduced a known bug before merge, I don't think it should be another bug/issue.

Just for clarity and to wrap this PR up.

The other issue/bug we are discussing is the implementation where a previously approved Official=True review will become Official=False after an official reviewer leaves an additional review. I believe this is the case because of the use of Official in a count query: https://github.com/go-gitea/gitea/blob/main/models/issues/pull.go#L384. As an aside, I believe we could accomplish the same result keeping Official=True and just using a SQL DISTINCT keyword on the ReviewerId of a Review.

This is existing behavior and NOT being modified in this PR. In my opinion, modifying or discussing changes to this behavior is outside of the scope of this PR.

The change reflected in this PR is that the comments list will also show a grey checkmark for all approved reviews that do not count towards the protected branches minimum approval limit. This includes approvals that may have previously counted, but no longer do. With these changes, a user will be able to count the green checkmarks in the comment list and they will match the approval count in the merge pr section. These suggestions were made by @yp05327 and concurred by @kdumontnu previously in this PR.

I'd really like to get this PR over the finish line so users can quickly determine which approvals do and do not count towards their protected branch limit. Are there any additional changes needed to get this merged?

@lunny
Copy link
Member

lunny commented Aug 30, 2024

OK. So this change may result in a new inconsistent between comment approval status and sidebar approval status. I think this is what @yp05327 is concerned about.

@kdumontnu
Copy link
Contributor

kdumontnu commented Aug 30, 2024

OK. So this change may result in a new inconsistent between comment approval status and sidebar approval status. I think this is what @yp05327 is concerned about.

I don’t think there is any issue here, especially with the latest change. @yp05327 can you approve if you’re in agreement?

as soon as the user leaves an updated review, the previous one will change to grey checkbox (unofficial). This reflects the database state & should be pretty clear/intuitive. The "green" checks clearly indicate which reviews are being counted to the total. Grey can be because the user doesn't have sufficient permissions or because they have left a second/third review.

imo, past reviews changing from green to grey is a good thing. It reflects what is counted towards approvals.

@lunny
Copy link
Member

lunny commented Aug 30, 2024

OK. So this change may result in a new inconsistent between comment approval status and sidebar approval status. I think this is what @yp05327 is concerned about.

I don’t think there is any issue here, especially with the latest change. @yp05327 can you approve if you’re in agreement?

as soon as the user leaves an updated review, the previous one will change to grey checkbox (unofficial). This reflects the database state & should be pretty clear/intuitive. The "green" checks clearly indicate which reviews are being counted to the total. Grey can be because the user doesn't have sufficient permissions or because they have left a second/third review.

imo, past reviews changing from green to grey is a good thing. It reflects what is counted towards approvals.

Yes. So maybe the approval status in the comment render template should be also changed to keep it consistent.

@william-allspice
Copy link
Contributor Author

OK. So this change may result in a new inconsistent between comment approval status and sidebar approval status. I think this is what @yp05327 is concerned about.

I don’t think there is any issue here, especially with the latest change. @yp05327 can you approve if you’re in agreement?

as soon as the user leaves an updated review, the previous one will change to grey checkbox (unofficial). This reflects the database state & should be pretty clear/intuitive. The "green" checks clearly indicate which reviews are being counted to the total. Grey can be because the user doesn't have sufficient permissions or because they have left a second/third review.

imo, past reviews changing from green to grey is a good thing. It reflects what is counted towards approvals.

Yes. So maybe the approval status in the comment render template should be also changed to keep it consistent.

Awesome. It sounds like we are all on the same page.

Here is a screen shot showing how this PR will make sure your latest review on the right hand side and in the comments list will match. And how older, dismissed, reviews will be grey.

Screenshot 2024-09-03 at 3 12 06 PM Screenshot 2024-09-03 at 3 12 37 PM

@yp05327 yp05327 added this to the 1.23.0 milestone Sep 5, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Sep 6, 2024
@lunny lunny enabled auto-merge (squash) September 6, 2024 06:10
@lunny lunny merged commit e9c64f4 into go-gitea:main Sep 6, 2024
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Sep 6, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull request Sep 9, 2024
* giteaofficial/main:
  [skip ci] Updated licenses and gitignores
  [skip ci] Updated translations via Crowdin
  Remove SHA1 for support for ssh rsa signing (go-gitea#31857)
  Upgrade cache to v0.2.1 (go-gitea#32003)
  Add automatic light/dark option for the colorblind theme (go-gitea#31997)
  [skip ci] Updated translations via Crowdin
  Use global lock instead of NewExclusivePool to allow distributed lock between multiple Gitea instances (go-gitea#31813)
  Use forum.gitea.com instead of old URL (go-gitea#31989)
  Distinguish official vs non-official reviews, add tool tips, and upgr… (go-gitea#31924)
techknowlogick pushed a commit that referenced this pull request Sep 18, 2024
A regression in #31924 caused there to be two `issues.review.comment`
keys in the English language locale file, leading to a problem when
reading PR review histories that contain comments.

This snapshot addresses this by making the newer key unique.
lunny added a commit that referenced this pull request Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/translation size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants