summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-06-15 03:12:33 +0200
committerGitHub <noreply@github.com>2021-06-14 21:12:33 -0400
commitebf253b841d56c5cb1e57cb1e5e50c06d315bdee (patch)
tree703f8c4d0302e578d402d6aa42635852303026df /models
parent0adcea9ba6946e9479314e188afe53dcb39da6b0 (diff)
downloadgitea-ebf253b841d56c5cb1e57cb1e5e50c06d315bdee.tar.gz
gitea-ebf253b841d56c5cb1e57cb1e5e50c06d315bdee.zip
Add attachments for PR reviews (#16075)
* First step for multiple dropzones per page. * Allow attachments on review comments. * Lint. * Fixed accidental initialize of the review textarea. * Initialize SimpleMDE textarea. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models')
-rw-r--r--models/issue_comment.go2
-rw-r--r--models/review.go15
2 files changed, 10 insertions, 7 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go
index 26bf122dc9..1b98b248b1 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -762,6 +762,8 @@ func updateCommentInfos(e *xorm.Session, opts *CreateCommentOptions, comment *Co
}
}
fallthrough
+ case CommentTypeReview:
+ fallthrough
case CommentTypeComment:
if _, err = e.Exec("UPDATE `issue` SET num_comments=num_comments+1 WHERE id=?", opts.Issue.ID); err != nil {
return err
diff --git a/models/review.go b/models/review.go
index 343621c0fa..316cbe4da6 100644
--- a/models/review.go
+++ b/models/review.go
@@ -347,7 +347,7 @@ func IsContentEmptyErr(err error) bool {
}
// SubmitReview creates a review out of the existing pending review or creates a new one if no pending review exist
-func SubmitReview(doer *User, issue *Issue, reviewType ReviewType, content, commitID string, stale bool) (*Review, *Comment, error) {
+func SubmitReview(doer *User, issue *Issue, reviewType ReviewType, content, commitID string, stale bool, attachmentUUIDs []string) (*Review, *Comment, error) {
sess := x.NewSession()
defer sess.Close()
if err := sess.Begin(); err != nil {
@@ -419,12 +419,13 @@ func SubmitReview(doer *User, issue *Issue, reviewType ReviewType, content, comm
}
comm, err := createComment(sess, &CreateCommentOptions{
- Type: CommentTypeReview,
- Doer: doer,
- Content: review.Content,
- Issue: issue,
- Repo: issue.Repo,
- ReviewID: review.ID,
+ Type: CommentTypeReview,
+ Doer: doer,
+ Content: review.Content,
+ Issue: issue,
+ Repo: issue.Repo,
+ ReviewID: review.ID,
+ Attachments: attachmentUUIDs,
})
if err != nil || comm == nil {
return nil, nil, err