manager: search role with unaccent lookup (#87906)
gitea/authentic/pipeline/head This commit looks good
Details
gitea/authentic/pipeline/head This commit looks good
Details
This commit is contained in:
parent
a03e111bab
commit
cdf52169c9
|
@ -405,7 +405,7 @@ class ServiceRoleSearchForm(CssClass, PrefixFormMixin, FormWithRequest):
|
|||
for word in (w.strip() for w in self.cleaned_data.get('text').split(' ')):
|
||||
if not word:
|
||||
continue
|
||||
qs = qs.filter(name__icontains=word)
|
||||
qs = qs.filter(name__unaccent__icontains=word)
|
||||
if not app_settings.SHOW_INTERNAL_ROLES and not self.cleaned_data.get('internals'):
|
||||
qs = qs.exclude(slug__startswith='_')
|
||||
return qs
|
||||
|
|
|
@ -390,7 +390,7 @@ def test_manager_role_csv_import(app, admin, ou1, ou2):
|
|||
'role_names,search_text,expt_found',
|
||||
[
|
||||
(
|
||||
['A random test role', 'Random test stuff', 'Some test role', 'Something else', 'SomeTest'],
|
||||
['A random test rôle', 'Random test stuff', 'Some test role', 'Something else', 'SomeTest'],
|
||||
' rand role',
|
||||
[0],
|
||||
),
|
||||
|
@ -419,6 +419,11 @@ def test_manager_role_csv_import(app, admin, ou1, ou2):
|
|||
' ',
|
||||
[0, 1, 2, 3, 4],
|
||||
),
|
||||
(
|
||||
['A random test role', 'Random test stuff', 'Some test role', 'Something else', 'SomeTest'],
|
||||
'rôle',
|
||||
[0, 2],
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_manager_role_search(app, admin, role_names, search_text, expt_found):
|
||||
|
|
Loading…
Reference in New Issue