diff options
Diffstat (limited to 'routers/repo/issue_label.go')
-rw-r--r-- | routers/repo/issue_label.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/routers/repo/issue_label.go b/routers/repo/issue_label.go index 9b4da4b500..f8a955ba6d 100644 --- a/routers/repo/issue_label.go +++ b/routers/repo/issue_label.go @@ -155,18 +155,14 @@ func UpdateIssueLabel(ctx *context.Context) { } if action == "toggle" { - anyHaveLabel := false + // detach if any issues already have label, otherwise attach + action = "attach" for _, issue := range issues { if issue.HasLabel(label.ID) { - anyHaveLabel = true + action = "detach" break } } - if anyHaveLabel { - action = "detach" - } else { - action = "attach" - } } if action == "attach" { |