1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

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>
This commit is contained in:
Lunny Xiao
2019-10-15 13:03:05 +08:00
committed by GitHub
parent 34fb9d68a5
commit 20477a69ea
6 changed files with 94 additions and 36 deletions

View File

@@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
issue_service "code.gitea.io/gitea/services/issue"
)
const (
@@ -132,7 +133,7 @@ func UpdateIssueLabel(ctx *context.Context) {
switch action := ctx.Query("action"); action {
case "clear":
for _, issue := range issues {
if err := issue.ClearLabels(ctx.User); err != nil {
if err := issue_service.ClearLabels(issue, ctx.User); err != nil {
ctx.ServerError("ClearLabels", err)
return
}