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

Delete review requests as non-admin #14459

Closed
1 task done
jpraet opened this issue Jan 25, 2021 · 12 comments · Fixed by #29057
Closed
1 task done

Delete review requests as non-admin #14459

jpraet opened this issue Jan 25, 2021 · 12 comments · Fixed by #29057
Assignees
Labels
type/bug type/proposal The new feature has not been accepted yet but needs to be discussed first.
Milestone

Comments

@jpraet
Copy link
Member

jpraet commented Jan 25, 2021

Description

When I request a review, I am not able to delete this review request if I am no administrator. I would expect at least to be able to delete a review request I created myself in case I selected the wrong person by accident. But I think even someone else should be able to delete the review request as well. Everyone that can add reviewers should also be able to delete them in my opinion?

Screenshots

I add a review request:

image

But I cannot delete it:

image

Unless when I am admin:

image

@lunny lunny added the type/bug label Jan 26, 2021
@a1012112796
Copy link
Member

a1012112796 commented Jan 26, 2021

That's follow github style.
see:
#10756 (comment)

@a1012112796 a1012112796 added type/proposal The new feature has not been accepted yet but needs to be discussed first. and removed type/bug labels Jan 26, 2021
@PaulBol
Copy link

PaulBol commented Dec 9, 2022

That's follow github style. see: #10756 (comment)

My understanding may be wrong. But to me it seems like the comment refers to review requests that have already been processed, i.e. approved or rejected by the reviewer. This issue mentions a pending review request.

I agree with jpraet that the person who requested the review should be able to delete the review request as long as it's not more than a request. What would be the reason do deny this?

@jpraet
Copy link
Member Author

jpraet commented Jan 14, 2023

I want to create a PR to allow the person who requested the review to be able to delete the review request.
But it looks like I cannot easily determine the author of the review request. It's not stored in the review table.

Would a PR get accepted that allows review request deletion to anyone that has permission to add review requests?

@jbartlau
Copy link

jbartlau commented May 8, 2023

Any news on this? Just landed here and would support such a change. @jpraet did you ever hear back from anyone?

@lunny
Copy link
Member

lunny commented May 8, 2023

Maybe we can accept the person himself could remove the review request?
Or everyone who have write permission to pull request could do that since the removal will be recorded in the comment timeline.

@jbartlau
Copy link

jbartlau commented May 8, 2023

everyone who have write permission to pull request could do that

That would totally suffice and was indeed what I had expected. And you could even restrict this to reviews that have not yet started. Our use case would be to assign a different reviewer if the originally requested reviewer is not available (e.g. vacation).

@lunny lunny added the type/enhancement An improvement of existing functionality label May 8, 2023
@lunny
Copy link
Member

lunny commented May 9, 2023

Looks like the code is there, but I don't know whether there are some bugs.

https://github.com/go-gitea/gitea/blob/main/routers/web/repo/issue.go#L634-L644

@KevinBaileyCrum
Copy link

this would be great, i have opened a pr in gitea, accidentally assigned a reviewer, then i cannot remove the reviewer,

i have had pr's get stuck because i added a reviewer who may be away from their computer for a long time and this completly blocks the merge (merge when all checks pass but an accidentally requested reviewer will always block)

@aleb
Copy link

aleb commented Sep 22, 2023

Looks like the code is there, but I don't know whether there are some bugs.

https://github.com/go-gitea/gitea/blob/main/routers/web/repo/issue.go#L634-L644

if ctx.Repo.IsAdmin() {
// Admin can dismiss or re-request any review requests
tmp.CanChange = true
} else if ctx.Doer != nil && ctx.Doer.ID == review.ReviewerID && review.Type == issues_model.ReviewTypeRequest {
// A user can refuse review requests
tmp.CanChange = true
} else if (canChooseReviewer || (ctx.Doer != nil && ctx.Doer.ID == issue.PosterID)) && review.Type != issues_model.ReviewTypeRequest &&
ctx.Doer.ID != review.ReviewerID {
// The poster of the PR, a manager, or official reviewers can re-request review from other reviewers
tmp.CanChange = true
}

Which part of that code should allow me to remove a reviewer as long as I'm able to add it back?

@6543 6543 changed the title Cannot delete review request Delete review requests as non-admin Nov 22, 2023
@hawicz
Copy link

hawicz commented Jan 31, 2024

The actual validation check seems to be in IsValidReviewRequest() at https://github.com/go-gitea/gitea/blob/main/services/issue/assignee.go#L157 (called from UpdatePullReviewRequest() at https://github.com/go-gitea/gitea/blob/main/routers/web/repo/issue.go#L2475), and only allows you to remove yourself, unless you're an admin.
This seems unnecessarily restrictive to me too.

@lunny lunny added type/bug and removed type/enhancement An improvement of existing functionality labels Feb 2, 2024
@lunny lunny added this to the 1.21.6 milestone Feb 2, 2024
@lunny lunny self-assigned this Feb 2, 2024
@lunny
Copy link
Member

lunny commented Feb 2, 2024

How about everyone who is a member of that repository with read-permissions can add/remove reviewer requests of every pull requests and the PR creators can also do that for their created PRs? If nobody against, I will send a PR to fix that.

@KevinBaileyCrum
Copy link

KevinBaileyCrum commented Feb 2, 2024 via email

@lunny lunny modified the milestones: 1.21.6, 1.22.0 Feb 20, 2024
lunny pushed a commit that referenced this issue Feb 24, 2024
Fix #14459

The following users can add/remove review requests of a PR
- the poster of the PR
- the owner or collaborators of the repository
- members with read permission on the pull requests unit
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/bug type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants