@@ -246,7 +246,7 @@ func UpdateLabel(l *Label) error {
246
246
if ! LabelColorPattern .MatchString (l .Color ) {
247
247
return fmt .Errorf ("bad color code: %s" , l .Color )
248
248
}
249
- return updateLabel (x , l )
249
+ return updateLabelCols (x , l , "name" , "description" , "color" )
250
250
}
251
251
252
252
// DeleteLabel delete a label
@@ -587,7 +587,7 @@ func GetLabelsByIssueID(issueID int64) ([]*Label, error) {
587
587
return getLabelsByIssueID (x , issueID )
588
588
}
589
589
590
- func updateLabel (e Engine , l * Label ) error {
590
+ func updateLabelCols (e Engine , l * Label , cols ... string ) error {
591
591
_ , err := e .ID (l .ID ).
592
592
SetExpr ("num_issues" ,
593
593
builder .Select ("count(*)" ).From ("issue_label" ).
@@ -601,7 +601,7 @@ func updateLabel(e Engine, l *Label) error {
601
601
"issue.is_closed" : true ,
602
602
}),
603
603
).
604
- AllCols ( ).Update (l )
604
+ Cols ( cols ... ).Update (l )
605
605
return err
606
606
}
607
607
@@ -653,7 +653,7 @@ func newIssueLabel(e *xorm.Session, issue *Issue, label *Label, doer *User) (err
653
653
return err
654
654
}
655
655
656
- return updateLabel (e , label )
656
+ return updateLabelCols (e , label , "num_issues" , "num_closed_issue" )
657
657
}
658
658
659
659
// NewIssueLabel creates a new issue-label relation.
@@ -729,7 +729,7 @@ func deleteIssueLabel(e *xorm.Session, issue *Issue, label *Label, doer *User) (
729
729
return err
730
730
}
731
731
732
- return updateLabel (e , label )
732
+ return updateLabelCols (e , label , "num_issues" , "num_closed_issue" )
733
733
}
734
734
735
735
// DeleteIssueLabel deletes issue-label relation.
0 commit comments