Skip to content

Commit d413a1f

Browse files
Gustedwxiaoguang
Gusted
andauthored
Improve the comment for 2FA filter in admin panel (#18017)
Replace TODO with explanation Co-authored-by: wxiaoguang <[email protected]>
1 parent 696521b commit d413a1f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

models/user/search.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ func (opts *SearchUserOptions) toSearchQueryBase() *xorm.Session {
107107
}
108108

109109
// 2fa filter uses LEFT JOIN to check whether a user has a 2fa record
110-
// TODO: bad performance here, maybe there will be a column "is_2fa_enabled" in the future
110+
// While using LEFT JOIN, sometimes the performance might not be good, but it won't be a problem now, such SQL is seldom executed.
111+
// There are some possible methods to refactor this SQL in future when we really need to optimize the performance (but not now):
112+
// (1) add a column in user table (2) add a setting value in user_setting table (3) use search engines (bleve/elasticsearch)
111113
if opts.IsTwoFactorEnabled.IsTrue() {
112114
cond = cond.And(builder.Expr("two_factor.uid IS NOT NULL"))
113115
} else {

0 commit comments

Comments
 (0)