diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-05-20 10:26:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 04:26:04 +0200 |
commit | cc7236e852e60e4dc9c4fb5692ac62697ef0e9e3 (patch) | |
tree | fdc3a7c3fbb3a5af6954673dfbb627619c0539aa /services | |
parent | 3b359b1629c3b6ae35c64c750fa66b9bd4f5d223 (diff) | |
download | gitea-cc7236e852e60e4dc9c4fb5692ac62697ef0e9e3.tar.gz gitea-cc7236e852e60e4dc9c4fb5692ac62697ef0e9e3.zip |
Make Ctrl+Enter (quick submit) work for issue comment and wiki editor (#19729)
* Make Ctrl+Enter (quick submit) work for issue comment and wiki editor
* Remove the required `SubmitReviewForm.Type`, empty type (triggered by quick submit) means "comment"
* Merge duplicate code
Diffstat (limited to 'services')
-rw-r--r-- | services/forms/repo_form.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index 18cbac751c..2bcb91f8c3 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -623,7 +623,7 @@ func (f *CodeCommentForm) Validate(req *http.Request, errs binding.Errors) bindi // SubmitReviewForm for submitting a finished code review type SubmitReviewForm struct { Content string - Type string `binding:"Required;In(approve,comment,reject)"` + Type string CommitID string Files []string } @@ -634,7 +634,7 @@ func (f *SubmitReviewForm) Validate(req *http.Request, errs binding.Errors) bind return middleware.Validate(errs, ctx.Data, f, ctx.Locale) } -// ReviewType will return the corresponding reviewtype for type +// ReviewType will return the corresponding ReviewType for type func (f SubmitReviewForm) ReviewType() models.ReviewType { switch f.Type { case "approve": @@ -643,6 +643,8 @@ func (f SubmitReviewForm) ReviewType() models.ReviewType { return models.ReviewTypeComment case "reject": return models.ReviewTypeReject + case "": + return models.ReviewTypeComment // default to comment when doing quick-submit (Ctrl+Enter) on the review form default: return models.ReviewTypeUnknown } |