Skip to content

feat(calendar): order calendars by sortOrder and move them from the drawer - #76

Merged
rathlinus merged 1 commit into
bulwarkmail:mainfrom
lucletoffe:feat/calendar-sort-order
Oct 15, 2026
Merged

rathlinus merged 1 commit into
bulwarkmail:mainfrom
lucletoffe:feat/calendar-sort-order

Conversation

@lucletoffe

Copy link
Copy Markdown
Contributor

Problem

Calendars are listed in the order the server returns them (creation order on Stalwart) and sortOrder is never read, so a calendar added later, such as public holidays, sits between the ones used every day and cannot be moved. Same change as the webmail side in bulwarkmail/webmail#1244.

Changes

  • src/lib/calendar-sort.ts (pure): compareCalendars (lower sortOrder first, equal sortOrder by name, case- and accent-insensitive, numbers by value, as JMAP Calendars asks), sortCalendars (each account's calendars kept together, own first), sortOrderUpdates, moveCalendar.
  • src/stores/calendar-store.ts: the calendar list is kept sorted (fetch, create, update); new reorderCalendars(orderedIds) renumbers the account's calendars 1, 2, 3... and writes sortOrder (Calendar/set, owning account and raw id) only where it changes, optimistically; after a failed write the list shows what the server actually holds.
  • CalendarSidebarDrawer long-press panel: Move up / Move down for the user's own calendars (existing settings.account.accounts.move_up/move_down strings, no new keys). The panel stays open so a calendar can be moved several places.

Tests

  • src/lib/__tests__/calendar-sort.test.ts (12) and src/stores/__tests__/calendar-store-sort-order.test.ts (3, fail without the store change).
  • npm test: 3307 passed / 17 skipped; npm run typecheck: clean; npm run i18n:check: all keys covered.
  • Release build on a 0.1.75 base installed and started on Android 13.

🤖 Generated with Claude Code

…rawer

Calendars were listed in the order the server returns them (creation
order on Stalwart) and sortOrder was never read. Sort them like the
webmail now does and as JMAP Calendars asks: lower sortOrder first,
equal sortOrder by name (case- and accent-insensitive, numbers by
value), each account's calendars kept together. The store keeps the list
sorted, so the drawer, the event editor and the other pickers agree.

The drawer's long-press panel gains Move up / Move down for the user's
own calendars. A move renumbers that account's calendars 1, 2, 3... and
writes sortOrder only where it changes; the panel stays open so a
calendar can be moved several places.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@rathlinus
rathlinus merged commit 14dc5ff into bulwarkmail:main Oct 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants