mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-24 10:00:50 +00:00
prevent empty review comment (#4632)
* prevent empty review comment This would only require a comment for rejection and comment * add tests * add comment
This commit is contained in:
parent
59b10e66f7
commit
0df7cab4fb
4 changed files with 57 additions and 0 deletions
|
@ -402,6 +402,14 @@ func (f SubmitReviewForm) ReviewType() models.ReviewType {
|
|||
}
|
||||
}
|
||||
|
||||
// HasEmptyContent checks if the content of the review form is empty.
|
||||
func (f SubmitReviewForm) HasEmptyContent() bool {
|
||||
reviewType := f.ReviewType()
|
||||
|
||||
return (reviewType == models.ReviewTypeComment || reviewType == models.ReviewTypeReject) &&
|
||||
len(strings.TrimSpace(f.Content)) == 0
|
||||
}
|
||||
|
||||
// __________ .__
|
||||
// \______ \ ____ | | ____ _____ ______ ____
|
||||
// | _// __ \| | _/ __ \\__ \ / ___// __ \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue