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>
tokarchuk/v1.17
Tyrone Yeh 2 years ago committed by GitHub
parent bed13bfa9e
commit e0f35ea00f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      models/issues/milestone.go

@ -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

Loading…
Cancel
Save