mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-02 19:39:49 +02:00
fix(api): allow pending-inline-comment-only reviews (#39433)
Prior to this change, the API rejected reviews without a summary
comment, even if it had pending inline comments. This differs from the
web UI, which accepts such reviews. The affected endpoints are:
1. Submitting via POST /repos/{owner}/{repo}/pulls/{index}/reviews/{id}.
2. Creating via POST /repos/{owner}/{repo}/pulls/{index}/reviews, both
when finishing an existing pending review and when creating a new
pending review.
The endpoints ran their own emptiness check, which ignored comments
already in a pending review. The fix drops it for comment and pending
reviews and relies on the model's check, which counts them, as the web
UI does.
A review with neither a body nor inline comments remains invalid.
---------
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
3 files changed
+35
-30
No files matched your search
@@ -456,7 +456,7 @@ func ReviewExists(ctx context.Context, issue *Issue, treePath string, line int64
|
||||
type ContentEmptyErr struct{}
|
||||
|
||||
func (ContentEmptyErr) Error() string {
|
||||
return "Review content is empty"
|
||||
return "review requires a body or a comment"
|
||||
}
|
||||
|
||||
// IsContentEmptyErr returns true if err is a ContentEmptyErr
|
||||
|
||||
Reference in new issue
Block a user