Skip to content

Commit

Permalink
fix: search users with accents
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfran committed Nov 12, 2024
1 parent 84accc0 commit 1957161
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ SelectUserDirective = (
roles = []
lightboxService.open($el)

normalize = (text) ->
text.toUpperCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '')

getFilteredUsers = (text="") ->
selected = _.compact(_.sortBy(
_.filter(users, (x) ->
Expand All @@ -34,8 +37,9 @@ SelectUserDirective = (
if row.type == 'user' && _.find(selected, ['id', row.id])
return false

name = row.name.toUpperCase()
text = text.toUpperCase()
name = normalize(row.name)
text = normalize(text)

return _.includes(name, text)

collection = _.union(
Expand Down

0 comments on commit 1957161

Please sign in to comment.