From 42b4befc70fe6db5180b185686d4c8ebaba24a0c Mon Sep 17 00:00:00 2001 From: Jimmy Praet Date: Sun, 17 Jan 2021 13:43:35 +0100 Subject: [PATCH] label and milestone webhooks on issue/pull creation --- services/issue/issue.go | 6 ++++++ services/pull/pull.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/services/issue/issue.go b/services/issue/issue.go index 14de0290a1b11..90f689a55cc3e 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -29,6 +29,12 @@ func NewIssue(repo *models.Repository, issue *models.Issue, labelIDs []int64, uu } notification.NotifyNewIssue(issue, mentions) + if len(issue.Labels) > 0 { + notification.NotifyIssueChangeLabels(issue.Poster, issue, issue.Labels, nil) + } + if issue.Milestone != nil { + notification.NotifyIssueChangeMilestone(issue.Poster, issue, 0) + } return nil } diff --git a/services/pull/pull.go b/services/pull/pull.go index 1886448ee0093..92f1ff65fb2fd 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -59,6 +59,12 @@ func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int6 } notification.NotifyNewPullRequest(pr, mentions) + if len(pull.Labels) > 0 { + notification.NotifyIssueChangeLabels(pull.Poster, pull, pull.Labels, nil) + } + if pull.Milestone != nil { + notification.NotifyIssueChangeMilestone(pull.Poster, pull, 0) + } // add first push codes comment baseGitRepo, err := git.OpenRepository(pr.BaseRepo.RepoPath())