Repository navigation
feat(calendar): order calendars by sortOrder and move them from the drawer - #76
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Calendars are listed in the order the server returns them (creation order on Stalwart) and
sortOrderis 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(lowersortOrderfirst, equalsortOrderby 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); newreorderCalendars(orderedIds)renumbers the account's calendars 1, 2, 3... and writessortOrder(Calendar/set, owning account and raw id) only where it changes, optimistically; after a failed write the list shows what the server actually holds.CalendarSidebarDrawerlong-press panel: Move up / Move down for the user's own calendars (existingsettings.account.accounts.move_up/move_downstrings, no new keys). The panel stays open so a calendar can be moved several places.Tests
src/lib/__tests__/calendar-sort.test.ts(12) andsrc/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.🤖 Generated with Claude Code