mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Implement Review form
Show Review comments on comment stream Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
@@ -371,6 +371,31 @@ func (f *CodeCommentForm) Validate(ctx *macaron.Context, errs binding.Errors) bi
|
||||
return validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// SubmitReviewForm for submitting a finished code review
|
||||
type SubmitReviewForm struct {
|
||||
Content string
|
||||
Type string `binding:"Required;In(approve,comment,reject)"`
|
||||
}
|
||||
|
||||
// Validate validates the fields
|
||||
func (f *SubmitReviewForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
||||
return validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// ReviewType will return the corresponding reviewtype for type
|
||||
func (f SubmitReviewForm) ReviewType() models.ReviewType {
|
||||
switch f.Type {
|
||||
case "approve":
|
||||
return models.ReviewTypeApprove
|
||||
case "comment":
|
||||
return models.ReviewTypeComment
|
||||
case "reject":
|
||||
return models.ReviewTypeReject
|
||||
default:
|
||||
return models.ReviewTypeUnknown
|
||||
}
|
||||
}
|
||||
|
||||
// __________ .__
|
||||
// \______ \ ____ | | ____ _____ ______ ____
|
||||
// | _// __ \| | _/ __ \\__ \ / ___// __ \
|
||||
|
Reference in New Issue
Block a user