mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 08:59:31 -05:00
aaeef295bb
* Move pull webhook to notification * fix fmt
35 lines
820 B
Go
35 lines
820 B
Go
// Copyright 2019 The Gitea Authors.
|
|
// All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package pull
|
|
|
|
import (
|
|
"code.gitea.io/gitea/models"
|
|
"code.gitea.io/gitea/modules/notification"
|
|
)
|
|
|
|
// CreateReview creates a new review based on opts
|
|
func CreateReview(opts models.CreateReviewOptions) (*models.Review, error) {
|
|
review, err := models.CreateReview(opts)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
notification.NotifyPullRequestReview(review.Issue.PullRequest, review, nil)
|
|
|
|
return review, nil
|
|
}
|
|
|
|
// UpdateReview updates a review
|
|
func UpdateReview(review *models.Review) error {
|
|
err := models.UpdateReview(review)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
notification.NotifyPullRequestReview(review.Issue.PullRequest, review, nil)
|
|
|
|
return nil
|
|
}
|