You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
820 B

  1. // Copyright 2019 The Gitea Authors.
  2. // All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package pull
  6. import (
  7. "code.gitea.io/gitea/models"
  8. "code.gitea.io/gitea/modules/notification"
  9. )
  10. // CreateReview creates a new review based on opts
  11. func CreateReview(opts models.CreateReviewOptions) (*models.Review, error) {
  12. review, err := models.CreateReview(opts)
  13. if err != nil {
  14. return nil, err
  15. }
  16. notification.NotifyPullRequestReview(review.Issue.PullRequest, review, nil)
  17. return review, nil
  18. }
  19. // UpdateReview updates a review
  20. func UpdateReview(review *models.Review) error {
  21. err := models.UpdateReview(review)
  22. if err != nil {
  23. return err
  24. }
  25. notification.NotifyPullRequestReview(review.Issue.PullRequest, review, nil)
  26. return nil
  27. }