mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-31 15:21:00 +08:00
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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user