feat: sort contacts sidebar ignoring case

This commit is contained in:
Robert Perce 2026-04-07 10:49:46 -05:00
parent 1206e211d5
commit 559c1f1760
2 changed files with 11 additions and 2 deletions

View file

@ -111,3 +111,12 @@ test('clicking off contact list when expanded closes it', async ({ page }) => {
await page.mouse.click(600, 500); await page.mouse.click(600, 500);
await expect(page.getByRole('button', { name: /add contact/i })).not.toBeVisible(); 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);
});

View file

@ -50,7 +50,7 @@ impl FromRequestParts<AppState> for Layout {
left join names n on c.id = n.contact_id left join names n on c.id = n.contact_id
where n.sort is null or n.sort = 0 where n.sort is null or n.sort = 0
and c.active = true and c.active = true
order by name asc", order by name collate nocase asc",
) )
.fetch_all(&state.db(&user).pool) .fetch_all(&state.db(&user).pool)
.await?; .await?;
@ -63,7 +63,7 @@ impl FromRequestParts<AppState> for Layout {
left join names n on c.id = n.contact_id left join names n on c.id = n.contact_id
where n.sort is null or n.sort = 0 where n.sort is null or n.sort = 0
and c.active = false and c.active = false
order by name asc", order by name collate nocase asc",
) )
.fetch_all(&state.db(&user).pool) .fetch_all(&state.db(&user).pool)
.await?; .await?;