Skip to content

Commit 3454c09

Browse files
committed
revert some changes
1 parent 1546d3c commit 3454c09

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

models/issues/label.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -495,23 +495,19 @@ func CountLabelsByOrgID(ctx context.Context, orgID int64) (int64, error) {
495495
}
496496

497497
func updateLabelCols(ctx context.Context, l *Label, cols ...string) error {
498-
sess := db.GetEngine(ctx).ID(l.ID)
499-
if slices.Contains(cols, "num_issues") {
500-
sess.SetExpr("num_issues",
498+
_, err := db.GetEngine(ctx).ID(l.ID).
499+
SetExpr("num_issues",
501500
builder.Select("count(*)").From("issue_label").
502501
Where(builder.Eq{"label_id": l.ID}),
503-
)
504-
}
505-
if slices.Contains(cols, "num_closed_issues") {
506-
sess.SetExpr("num_closed_issues",
502+
).
503+
SetExpr("num_closed_issues",
507504
builder.Select("count(*)").From("issue_label").
508505
InnerJoin("issue", "issue_label.issue_id = issue.id").
509506
Where(builder.Eq{
510507
"issue_label.label_id": l.ID,
511508
"issue.is_closed": true,
512509
}),
513-
)
514-
}
515-
_, err := sess.Cols(cols...).Update(l)
510+
).
511+
Cols(cols...).Update(l)
516512
return err
517513
}

models/user/must_change_password.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ func SetMustChangePassword(ctx context.Context, all, mustChangePassword bool, in
4545
cond = cond.And(builder.NotIn("lower_name", exclude))
4646
}
4747

48-
return db.GetEngine(ctx).Where(cond).Cols("must_change_password").Update(&User{MustChangePassword: mustChangePassword})
48+
return db.GetEngine(ctx).Where(cond).MustCols("must_change_password").Update(&User{MustChangePassword: mustChangePassword})
4949
}

0 commit comments

Comments
 (0)