Skip to content

[WIP] Issue webhook #908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Milestone webhooks
  • Loading branch information
thehowl committed Feb 11, 2017
commit e166e6d8102a36da9dbd19b8d861f71f631d2afd
18 changes: 18 additions & 0 deletions models/issue_milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/sdk/gitea"

"code.gitea.io/gitea/modules/log"
"github.com/go-xorm/xorm"
)

Expand Down Expand Up @@ -311,6 +312,23 @@ func ChangeMilestoneAssign(issue *Issue, doer *User, oldMilestoneID int64) (err
if err = changeMilestoneAssign(sess, doer, issue, oldMilestoneID); err != nil {
return err
}

base := newBaseIssueHook(api.HookIssueMilestoned, issue, doer)
if issue.MilestoneID == 0 {
base.Action = api.HookIssueDemilestoned
}
if issue.IsPull {
issue.PullRequest.Issue = issue
err = PrepareWebhooks(issue.Repo, HookEventPullRequest, base.ToPRPayload(issue.PullRequest.APIFormat()))
} else {
err = PrepareWebhooks(issue.Repo, HookEventIssue, base.ToIssuePayload(issue.APIFormat()))
}
if err != nil {
log.Error(4, "PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
} else {
go HookQueue.Add(issue.RepoID)
}

return sess.Commit()
}

Expand Down