From b88dbe1208e970776119d1b3c2807f995306d4b2 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 25 Aug 2021 20:23:34 +0800 Subject: [PATCH] Use a common quote to instead of check database type (#16817) `` ` `` will be converted to different database quote by xorm. So check database type is unnecessary. --- models/user.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/models/user.go b/models/user.go index 1af9e545ade..a2d185de39d 100644 --- a/models/user.go +++ b/models/user.go @@ -1619,14 +1619,7 @@ func (opts *SearchUserOptions) toConds() builder.Cond { } if opts.Actor != nil { - var exprCond builder.Cond - if setting.Database.UseMySQL { - exprCond = builder.Expr("org_user.org_id = user.id") - } else if setting.Database.UseMSSQL { - exprCond = builder.Expr("org_user.org_id = [user].id") - } else { - exprCond = builder.Expr("org_user.org_id = \"user\".id") - } + var exprCond builder.Cond = builder.Expr("org_user.org_id = `user`.id") // If Admin - they see all users! if !opts.Actor.IsAdmin {