From 559c1f17601fc595fe22117a288c8409cf6b3fcb Mon Sep 17 00:00:00 2001 From: Robert Perce Date: Tue, 7 Apr 2026 10:49:46 -0500 Subject: [PATCH] feat: sort contacts sidebar ignoring case --- e2e/pages/home.spec.ts | 9 +++++++++ src/web/mod.rs | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/e2e/pages/home.spec.ts b/e2e/pages/home.spec.ts index d852a0e..db98bb1 100644 --- a/e2e/pages/home.spec.ts +++ b/e2e/pages/home.spec.ts @@ -111,3 +111,12 @@ test('clicking off contact list when expanded closes it', async ({ page }) => { await page.mouse.click(600, 500); await expect(page.getByRole('button', { name: /add contact/i })).not.toBeVisible(); }); + +test('contact list is sorted ignoring case', async ({ page }) => { + await verifyCreateUser(page, { names: ['Alfa'] }); + await verifyCreateUser(page, { names: ['bob'] }); + await verifyCreateUser(page, { names: ['Charlie'] }); + + await expect(page.locator('#contacts-sidebar')).toContainText(/alfa\s*bob\s*charlie/i); + +}); diff --git a/src/web/mod.rs b/src/web/mod.rs index 3a3a47c..c6b0462 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -50,7 +50,7 @@ impl FromRequestParts for Layout { left join names n on c.id = n.contact_id where n.sort is null or n.sort = 0 and c.active = true - order by name asc", + order by name collate nocase asc", ) .fetch_all(&state.db(&user).pool) .await?; @@ -63,7 +63,7 @@ impl FromRequestParts for Layout { left join names n on c.id = n.contact_id where n.sort is null or n.sort = 0 and c.active = false - order by name asc", + order by name collate nocase asc", ) .fetch_all(&state.db(&user).pool) .await?;