aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorwxiaoguang2023-03-04 15:13:37 +0800
committerGitHub2023-03-04 02:13:37 -0500
commit188c8c12c290e131fb342e3203634828652b0af5 (patch)
tree228bd46aa0aed2f059e7bd5a71ab42e7ceebe52e /services
parent47b912cd526207f831bff759b29a734049d1c8f2 (diff)
Make Ctrl+Enter submit a pending comment (starting review) instead of submitting a single comment (#23245)
Close #23241 Before: press Ctrl+Enter in the Code Review Form, a single comment will be added. After: press Ctrl+Enter in the Code Review Form, start the review with pending comments. The old name `is_review` is not clear, so the new code use `pending_review` as the new name. Co-authored-by: delvh <leon@kske.dev> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'services')
-rw-r--r--services/forms/repo_form.go2
-rw-r--r--services/mailer/incoming/incoming_handler.go2
-rw-r--r--services/pull/review.go8
3 files changed, 6 insertions, 6 deletions
diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go
index e9645b5ab..3bd073c07 100644
--- a/services/forms/repo_form.go
+++ b/services/forms/repo_form.go
@@ -622,7 +622,7 @@ type CodeCommentForm struct {
Side string `binding:"Required;In(previous,proposed)"`
Line int64
TreePath string `form:"path" binding:"Required"`
- IsReview bool `form:"is_review"`
+ SingleReview bool `form:"single_review"`
Reply int64 `form:"reply"`
LatestCommitID string
}
diff --git a/services/mailer/incoming/incoming_handler.go b/services/mailer/incoming/incoming_handler.go
index d89a5eab3..454039c60 100644
--- a/services/mailer/incoming/incoming_handler.go
+++ b/services/mailer/incoming/incoming_handler.go
@@ -127,7 +127,7 @@ func (h *ReplyHandler) Handle(ctx context.Context, content *MailContent, doer *u
comment.Line,
content.Content,
comment.TreePath,
- false,
+ false, // not pending review but a single review
comment.ReviewID,
"",
)
diff --git a/services/pull/review.go b/services/pull/review.go
index ca386ca6b..ba93b5e2f 100644
--- a/services/pull/review.go
+++ b/services/pull/review.go
@@ -71,7 +71,7 @@ func InvalidateCodeComments(ctx context.Context, prs issues_model.PullRequestLis
}
// CreateCodeComment creates a comment on the code line
-func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git.Repository, issue *issues_model.Issue, line int64, content, treePath string, isReview bool, replyReviewID int64, latestCommitID string) (*issues_model.Comment, error) {
+func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git.Repository, issue *issues_model.Issue, line int64, content, treePath string, pendingReview bool, replyReviewID int64, latestCommitID string) (*issues_model.Comment, error) {
var (
existsReview bool
err error
@@ -82,7 +82,7 @@ func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git.
// - Comments that are part of a review
// - Comments that reply to an existing review
- if !isReview && replyReviewID != 0 {
+ if !pendingReview && replyReviewID != 0 {
// It's not part of a review; maybe a reply to a review comment or a single comment.
// Check if there are reviews for that line already; if there are, this is a reply
if existsReview, err = issues_model.ReviewExists(issue, treePath, line); err != nil {
@@ -91,7 +91,7 @@ func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git.
}
// Comments that are replies don't require a review header to show up in the issue view
- if !isReview && existsReview {
+ if !pendingReview && existsReview {
if err = issue.LoadRepo(ctx); err != nil {
return nil, err
}
@@ -149,7 +149,7 @@ func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git.
return nil, err
}
- if !isReview && !existsReview {
+ if !pendingReview && !existsReview {
// Submit the review we've just created so the comment shows up in the issue view
if _, _, err = SubmitReview(ctx, doer, gitRepo, issue, issues_model.ReviewTypeComment, "", latestCommitID, nil); err != nil {
return nil, err