[v10.0/forgejo] fix: make author search case insenstive (#6783)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/6782 - Make the author search in the issues and pull request list case insenstive. - Background: Forgejo mandates that all columns are case senstive and only SQLite ignores this for ASCII characters with the `LIKE` operator any other database will indeed do case senstive searching. Codeberg recently made all columns case senstive, hence why this issue now surfaces. - Added integration test. - Resolves forgejo/forgejo#6744 Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6783 Reviewed-by: Beowulf <beowulf@beocode.eu> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
b615d41457
commit
ac01c7a384
2 changed files with 45 additions and 2 deletions
|
@ -166,9 +166,9 @@ func GetReviewers(ctx context.Context, repo *Repository, doerID, posterID int64)
|
|||
// If isShowFullName is set to true, also include full name prefix search
|
||||
func GetIssuePostersWithSearch(ctx context.Context, repo *Repository, isPull bool, search string, isShowFullName bool) ([]*user_model.User, error) {
|
||||
users := make([]*user_model.User, 0, 30)
|
||||
var prefixCond builder.Cond = builder.Like{"name", search + "%"}
|
||||
prefixCond := db.BuildCaseInsensitiveLike("name", search+"%")
|
||||
if isShowFullName {
|
||||
prefixCond = prefixCond.Or(builder.Like{"full_name", "%" + search + "%"})
|
||||
prefixCond = db.BuildCaseInsensitiveLike("full_name", "%"+search+"%")
|
||||
}
|
||||
|
||||
cond := builder.In("`user`.id",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue