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
This commit is contained in:
parent
3b359b1629
commit
cc7236e852
8 changed files with 54 additions and 16 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue