aboutsummaryrefslogtreecommitdiffstats
path: root/services/issue
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-02-23 23:53:08 +0100
committerGitHub <noreply@github.com>2020-02-23 22:53:08 +0000
commit39b507e3c4badca0fe253a127bcbde38483cf25b (patch)
tree2c7a591dac2158a3979698903d9c3df980a2c845 /services/issue
parent062f35109df236a06a00d403d006b90760f9cfac (diff)
downloadgitea-39b507e3c4badca0fe253a127bcbde38483cf25b.tar.gz
gitea-39b507e3c4badca0fe253a127bcbde38483cf25b.zip
Trigger webhooks on issue label-change via API too (#10421)
* trigger webhooks with api too * fix comment * notify report old too * CI restart * restart CI again * remove duplicated code
Diffstat (limited to 'services/issue')
-rw-r--r--services/issue/label.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/services/issue/label.go b/services/issue/label.go
index 5e154df959..d2c1cd6ec5 100644
--- a/services/issue/label.go
+++ b/services/issue/label.go
@@ -61,3 +61,18 @@ func RemoveLabel(issue *models.Issue, doer *models.User, label *models.Label) er
notification.NotifyIssueChangeLabels(doer, issue, nil, []*models.Label{label})
return nil
}
+
+// ReplaceLabels removes all current labels and add new labels to the issue.
+func ReplaceLabels(issue *models.Issue, doer *models.User, labels []*models.Label) error {
+ old, err := models.GetLabelsByIssueID(issue.ID)
+ if err != nil {
+ return err
+ }
+
+ if err := issue.ReplaceLabels(labels, doer); err != nil {
+ return err
+ }
+
+ notification.NotifyIssueChangeLabels(doer, issue, labels, old)
+ return nil
+}