diff options
author | SagePtr <sageptr@gmail.com> | 2018-08-16 13:52:51 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2018-08-16 19:52:51 +0800 |
commit | 50ce19eff78aa4e27d7fe6985614b89b9eec521c (patch) | |
tree | 5278c0dd35904756f4381dd009671b4b55a712e3 /models/issue_assignees.go | |
parent | 8273479b41297eff3530bc90a430ab03b6ba6895 (diff) | |
download | gitea-50ce19eff78aa4e27d7fe6985614b89b9eec521c.tar.gz gitea-50ce19eff78aa4e27d7fe6985614b89b9eec521c.zip |
Fix failure on creating pull request with assignees (#4419) (#4583)
Diffstat (limited to 'models/issue_assignees.go')
-rw-r--r-- | models/issue_assignees.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/models/issue_assignees.go b/models/issue_assignees.go index 24773cc576..b4f346974b 100644 --- a/models/issue_assignees.go +++ b/models/issue_assignees.go @@ -134,14 +134,14 @@ func (issue *Issue) ChangeAssignee(doer *User, assigneeID int64) (err error) { return err } - if err := issue.changeAssignee(sess, doer, assigneeID); err != nil { + if err := issue.changeAssignee(sess, doer, assigneeID, false); err != nil { return err } return sess.Commit() } -func (issue *Issue) changeAssignee(sess *xorm.Session, doer *User, assigneeID int64) (err error) { +func (issue *Issue) changeAssignee(sess *xorm.Session, doer *User, assigneeID int64, isCreate bool) (err error) { // Update the assignee removed, err := updateIssueAssignee(sess, issue, assigneeID) @@ -161,6 +161,10 @@ func (issue *Issue) changeAssignee(sess *xorm.Session, doer *User, assigneeID in mode, _ := accessLevel(sess, doer.ID, issue.Repo) if issue.IsPull { + // if pull request is in the middle of creation - don't call webhook + if isCreate { + return nil + } if err = issue.loadPullRequest(sess); err != nil { return fmt.Errorf("loadPullRequest: %v", err) } |