diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-06-15 03:12:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-14 21:12:33 -0400 |
commit | ebf253b841d56c5cb1e57cb1e5e50c06d315bdee (patch) | |
tree | 703f8c4d0302e578d402d6aa42635852303026df /services | |
parent | 0adcea9ba6946e9479314e188afe53dcb39da6b0 (diff) | |
download | gitea-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 'services')
-rw-r--r-- | services/forms/repo_form.go | 1 | ||||
-rw-r--r-- | services/pull/review.go | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index a40b0be9a7..71a83a8be3 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -587,6 +587,7 @@ type SubmitReviewForm struct { Content string Type string `binding:"Required;In(approve,comment,reject)"` CommitID string + Files []string } // Validate validates the fields diff --git a/services/pull/review.go b/services/pull/review.go index 4b647722fc..b07e21fad9 100644 --- a/services/pull/review.go +++ b/services/pull/review.go @@ -100,7 +100,7 @@ func CreateCodeComment(doer *models.User, gitRepo *git.Repository, issue *models if !isReview && !existsReview { // Submit the review we've just created so the comment shows up in the issue view - if _, _, err = SubmitReview(doer, gitRepo, issue, models.ReviewTypeComment, "", latestCommitID); err != nil { + if _, _, err = SubmitReview(doer, gitRepo, issue, models.ReviewTypeComment, "", latestCommitID, nil); err != nil { return nil, err } } @@ -215,7 +215,7 @@ func createCodeComment(doer *models.User, repo *models.Repository, issue *models } // SubmitReview creates a review out of the existing pending review or creates a new one if no pending review exist -func SubmitReview(doer *models.User, gitRepo *git.Repository, issue *models.Issue, reviewType models.ReviewType, content, commitID string) (*models.Review, *models.Comment, error) { +func SubmitReview(doer *models.User, gitRepo *git.Repository, issue *models.Issue, reviewType models.ReviewType, content, commitID string, attachmentUUIDs []string) (*models.Review, *models.Comment, error) { pr, err := issue.GetPullRequest() if err != nil { return nil, nil, err @@ -240,7 +240,7 @@ func SubmitReview(doer *models.User, gitRepo *git.Repository, issue *models.Issu } } - review, comm, err := models.SubmitReview(doer, issue, reviewType, content, commitID, stale) + review, comm, err := models.SubmitReview(doer, issue, reviewType, content, commitID, stale, attachmentUUIDs) if err != nil { return nil, nil, err } |