diff options
author | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2016-08-24 21:01:30 +0200 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2016-08-24 12:01:30 -0700 |
commit | 06602a84ff0ed352c8998cc3ca9ff0350e0906ef (patch) | |
tree | fe6a9e6760c14dd9311dcc1582d315575b01afdd | |
parent | b710f6bd6506d408ae226e3bbef706906e26b61e (diff) | |
download | gitea-06602a84ff0ed352c8998cc3ca9ff0350e0906ef.tar.gz gitea-06602a84ff0ed352c8998cc3ca9ff0350e0906ef.zip |
Fix PR-webhook issue where Label-data is stale (#3486) (#3510)
* Fix PR-webhook issue where Label-data is stale
* Conventions \o/
* logs are nice if they're consistent...
-rw-r--r-- | models/issue.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/models/issue.go b/models/issue.go index 3e19d11907..6bbc0f8714 100644 --- a/models/issue.go +++ b/models/issue.go @@ -235,7 +235,11 @@ func (i *Issue) HasLabel(labelID int64) bool { func (issue *Issue) sendLabelUpdatedWebhook(doer *User) { var err error if issue.IsPull { - issue.PullRequest.Issue = issue + err = issue.PullRequest.LoadIssue() + if err != nil { + log.Error(4, "LoadIssue: %v", err) + return + } err = PrepareWebhooks(issue.Repo, HOOK_EVENT_PULL_REQUEST, &api.PullRequestPayload{ Action: api.HOOK_ISSUE_LABEL_UPDATED, Index: issue.Index, @@ -335,7 +339,11 @@ func (issue *Issue) ClearLabels(doer *User) (err error) { } if issue.IsPull { - issue.PullRequest.Issue = issue + err = issue.PullRequest.LoadIssue() + if err != nil { + log.Error(4, "LoadIssue: %v", err) + return + } err = PrepareWebhooks(issue.Repo, HOOK_EVENT_PULL_REQUEST, &api.PullRequestPayload{ Action: api.HOOK_ISSUE_LABEL_CLEARED, Index: issue.Index, |