summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-10-15 13:03:05 +0800
committerGitHub <noreply@github.com>2019-10-15 13:03:05 +0800
commit20477a69ea123a7800ebf94bfd2225eb9ae90e8f (patch)
tree0e01914d69bd5dbda358c7c5ce90c375e0f29be0 /services
parent34fb9d68a5567423ddde736ff42f9780f4048366 (diff)
downloadgitea-20477a69ea123a7800ebf94bfd2225eb9ae90e8f.tar.gz
gitea-20477a69ea123a7800ebf94bfd2225eb9ae90e8f.zip
Move clearlabels from models to issue service (#8326)
* move clearlabels from models to issue service * improve code * Apply suggestions from code review Co-Authored-By: zeripath <art27@cantab.net>
Diffstat (limited to 'services')
-rw-r--r--services/issue/label.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/services/issue/label.go b/services/issue/label.go
new file mode 100644
index 0000000000..4af8c2b97e
--- /dev/null
+++ b/services/issue/label.go
@@ -0,0 +1,21 @@
+// Copyright 2019 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package issue
+
+import (
+ "code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/notification"
+)
+
+// ClearLabels clears all of an issue's labels
+func ClearLabels(issue *models.Issue, doer *models.User) (err error) {
+ if err = issue.ClearLabels(doer); err != nil {
+ return
+ }
+
+ notification.NotifyIssueClearLabels(doer, issue)
+
+ return nil
+}