Modify milestone search keywords to be case insensitive (#20266) (#20498)

* Modify milestone search keywords to be case insensitive (#20266)

Milestone search keywords are now sensitive, this modification is changed to insensitive

* Modify for #18437

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Tyrone Yeh 2022-07-27 19:55:09 +08:00 committed by GitHub
parent bed13bfa9e
commit e0f35ea00f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,7 @@ import (
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs" api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
"xorm.io/builder" "xorm.io/builder"
) )
@ -361,7 +362,11 @@ func (opts GetMilestonesOption) toCond() builder.Cond {
} }
if len(opts.Name) != 0 { if len(opts.Name) != 0 {
cond = cond.And(builder.Like{"name", opts.Name}) if setting.Database.UseSQLite3 {
cond = cond.And(builder.Like{"UPPER(name)", util.ToUpperASCII(opts.Name)})
} else {
cond = cond.And(builder.Like{"UPPER(name)", strings.ToUpper(opts.Name)})
}
} }
return cond return cond