Skip to content

Commit 7dfe919

Browse files
committed
improve code
1 parent a6b087a commit 7dfe919

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

services/pulls/pulls.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import (
1313
)
1414

1515
// NewPullRequest creates new pull request with labels for repository.
16-
func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int64, uuids []string, pr *models.PullRequest, patch []byte, assigneeIDs []int64) (err error) {
17-
if err = models.NewPullRequest(repo, pull, labelIDs, uuids, pr, patch, assigneeIDs); err != nil {
18-
return
16+
func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int64, uuids []string, pr *models.PullRequest, patch []byte, assigneeIDs []int64) error {
17+
if err := models.NewPullRequest(repo, pull, labelIDs, uuids, pr, patch, assigneeIDs); err != nil {
18+
return err
1919
}
2020

21-
if err = models.NotifyWatchers(&models.Action{
21+
if err := models.NotifyWatchers(&models.Action{
2222
ActUserID: pull.Poster.ID,
2323
ActUser: pull.Poster,
2424
OpType: models.ActionCreatePullRequest,
@@ -33,7 +33,7 @@ func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int6
3333
pr.Issue = pull
3434
pull.PullRequest = pr
3535
mode, _ := models.AccessLevel(pull.Poster, repo)
36-
if err = models.PrepareWebhooks(repo, models.HookEventPullRequest, &api.PullRequestPayload{
36+
if err := models.PrepareWebhooks(repo, models.HookEventPullRequest, &api.PullRequestPayload{
3737
Action: api.HookIssueOpened,
3838
Index: pull.Index,
3939
PullRequest: pr.APIFormat(),
@@ -46,4 +46,4 @@ func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int6
4646
}
4747

4848
return nil
49-
}
49+
}

0 commit comments

Comments
 (0)