1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

lowercase the searchQuery to turns the search for users case-insensitive, in postgresql and sqlite.

This commit is contained in:
Hubert 2023-08-16 15:29:44 -03:00
parent f92ca399b8
commit eefebb2444

View File

@ -100,7 +100,7 @@ router.get('admin/users', async (_path: SubPath, ctx: AppContext) => {
await userModel.checkIfAllowed(ctx.joplin.owner, AclAction.List); await userModel.checkIfAllowed(ctx.joplin.owner, AclAction.List);
const showDisabled = ctx.query.show_disabled === '1'; const showDisabled = ctx.query.show_disabled === '1';
const searchQuery = ctx.query.query || ''; const searchQuery = (ctx.query.query && ctx.query.query.toLowerCase()) || '';
const pagination = makeTablePagination(ctx.query, 'full_name', PaginationOrderDir.ASC); const pagination = makeTablePagination(ctx.query, 'full_name', PaginationOrderDir.ASC);
pagination.limit = 1000; pagination.limit = 1000;
@ -112,7 +112,9 @@ router.get('admin/users', async (_path: SubPath, ctx: AppContext) => {
if (searchQuery) { if (searchQuery) {
void query.where(qb => { void query.where(qb => {
void qb.whereRaw('full_name like ?', [`%${searchQuery}%`]).orWhereRaw('email like ?', [`%${searchQuery}%`]); void qb
.whereRaw('lower(full_name) like ?', [`%${searchQuery}%`])
.orWhereRaw('lower(email) like ?', [`%${searchQuery}%`]);
}); });
} }