diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-08-14 23:32:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-14 23:32:19 +0800 |
commit | c021890930bc1f1e52ac538e3eab4c2574513dfa (patch) | |
tree | 60d41ae2b96f562d7d251ed5d76a29a3e142f16f /models/review.go | |
parent | eaa4d4ea98e62ebbc44039d0a01604a464d3ad2a (diff) | |
download | gitea-c021890930bc1f1e52ac538e3eab4c2574513dfa.tar.gz gitea-c021890930bc1f1e52ac538e3eab4c2574513dfa.zip |
move CreateReview to moduels/pull (#7841)
Diffstat (limited to 'models/review.go')
-rw-r--r-- | models/review.go | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/models/review.go b/models/review.go index 458d58152e..e31e936bcc 100644 --- a/models/review.go +++ b/models/review.go @@ -8,7 +8,6 @@ import ( "fmt" "code.gitea.io/gitea/modules/log" - api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/util" "github.com/go-xorm/xorm" @@ -235,42 +234,6 @@ func createReview(e Engine, opts CreateReviewOptions) (*Review, error) { return nil, err } - var reviewHookType HookEventType - - switch opts.Type { - case ReviewTypeApprove: - reviewHookType = HookEventPullRequestApproved - case ReviewTypeComment: - reviewHookType = HookEventPullRequestComment - case ReviewTypeReject: - reviewHookType = HookEventPullRequestRejected - default: - // unsupported review webhook type here - return review, nil - } - - pr := opts.Issue.PullRequest - - if err := pr.LoadIssue(); err != nil { - return nil, err - } - - mode, err := AccessLevel(opts.Issue.Poster, opts.Issue.Repo) - if err != nil { - return nil, err - } - - if err := PrepareWebhooks(opts.Issue.Repo, reviewHookType, &api.PullRequestPayload{ - Action: api.HookIssueSynchronized, - Index: opts.Issue.Index, - PullRequest: pr.APIFormat(), - Repository: opts.Issue.Repo.APIFormat(mode), - Sender: opts.Reviewer.APIFormat(), - }); err != nil { - return nil, err - } - go HookQueue.Add(opts.Issue.Repo.ID) - return review, nil } |