File tree 1 file changed +7
-3
lines changed 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2577,6 +2577,8 @@ func combineLabelComments(issue *models.Issue) {
2577
2577
if cur .Label != nil { // now cur MUST be label comment
2578
2578
if prev .Type == models .CommentTypeLabel { // we can combine them only prev is a label comment
2579
2579
if cur .Content != "1" {
2580
+ // remove labels from the AddedLabels list if the label that was removed is already
2581
+ // in this list, and if it's not in this list, add the label to RemovedLabels
2580
2582
addedAndRemoved := false
2581
2583
for i , label := range prev .AddedLabels {
2582
2584
if cur .Label .ID == label .ID {
@@ -2589,15 +2591,17 @@ func combineLabelComments(issue *models.Issue) {
2589
2591
prev .RemovedLabels = append (prev .RemovedLabels , cur .Label )
2590
2592
}
2591
2593
} else {
2592
- addedAndRemoved := false
2594
+ // remove labels from the RemovedLabels list if the label that was added is already
2595
+ // in this list, and if it's not in this list, add the label to AddedLabels
2596
+ removedAndAdded := false
2593
2597
for i , label := range prev .RemovedLabels {
2594
2598
if cur .Label .ID == label .ID {
2595
2599
prev .RemovedLabels = append (prev .RemovedLabels [:i ], prev .RemovedLabels [i + 1 :]... )
2596
- addedAndRemoved = true
2600
+ removedAndAdded = true
2597
2601
break
2598
2602
}
2599
2603
}
2600
- if ! addedAndRemoved {
2604
+ if ! removedAndAdded {
2601
2605
prev .AddedLabels = append (prev .AddedLabels , cur .Label )
2602
2606
}
2603
2607
}
You can’t perform that action at this time.
0 commit comments