feat(sources): allow editing CalDAV sources (URL, username, password, name)#73
Merged
Conversation
1f166a5 to
8c5f45a
Compare
Closes #72. Today the source row supports test/sync/remove and write-back-calendar selection but not editing the connection itself. Typo'd URL? Username mistake? Periodic CalDAV password rotation? The only path was delete-and-readd, which loses the synced events cache, the write-back configuration, and any per-event-type calendar selections that referenced calendars under the old source. Adds an Edit affordance on each source row (web) and a `calrs source update` command (CLI). The web POST and the CLI both go through small DB updates that scope by user_id (web) or by id-prefix (CLI matching existing convention). Notable details: - Password field is optional; empty means "keep existing". The web handler decrypts the stored blob to feed the connection-test client with credentials sync will use afterwards. The CLI uses an explicit --password flag that prompts via rpassword (so password isn't echoed and isn't visible in shell history). - URL still passes validate_caldav_url (SSRF guard); the connection test still respects the existing "Skip connection test" checkbox. - After URL or username changes, both surfaces hint that a manual sync is recommended to refresh the discovered calendar list. No automatic re-sync — the discovery flow's resolve_url() already re-resolves hrefs from the server origin, so the next manual sync self-heals. - Edit button only shown for sources the user owns; the GET handler scopes by user_id and redirects on access mismatch. Tests: 4 new web handler tests (form pre-fill, blank-password keeps existing, password rotation re-encrypts, cross-user access blocked). 583 tests total (up from 579), all green on pre-commit. Clippy clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- CLI source update now runs validate_caldav_url on the new URL, mirroring the web handler. Closes a parity gap where the web path rejected private IPs but the CLI happily accepted them. - Stop SELECT-ing and binding current_password_enc in the no-rotation arm; it was only used for a `let _ =` discard. Use a 4-tuple destructure instead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8c5f45a to
9004372
Compare
olivierlambert
added a commit
that referenced
this pull request
May 24, 2026
A modernization pass on operator-facing surfaces: source connection
details are now editable instead of delete-and-readd; SMTP gains
env-var configuration and proper port-465 support; the From: mailbox
stops mangling addresses without display names; and team event-type
management permissions are tightened so management routes can't be
reached via the read-only availability surface.
Highlights:
- Edit CalDAV sources from the dashboard (`/dashboard/sources/{id}/edit`)
or the CLI (`calrs source update <id-prefix>`); empty password keeps
the existing one (#73, closes #72).
- SMTP via `CALRS_SMTP_*` env vars + new `tls_mode` (starttls/tls)
fixing the port-465 hang for both env-var and DB-configured SMTP
(#56, migration 052).
- Fix `Error: Invalid input` on SMTP test when `from_name` is unset
by building the From: mailbox via `Mailbox::new` everywhere (#104).
- Team event-type management gated through a single
`can_manage_event_type` check; `delete_invite` now strictly requires
it (behaviour change for non-admin invite creators on internal
events); 8 new regression tests on the manageability matrix (#55).
671 tests total, up from 650 in 1.11.0. See CHANGELOG.md for details.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 28, 2026
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.
Summary
Closes #72. Today the source row at `/dashboard/sources` supports test, sync, remove, and write-back-calendar selection — but not editing the connection itself. Typo'd URL? Username mistake? Periodic CalDAV password rotation? The only path was delete-and-readd, which loses the synced events cache, the write-back configuration, and any per-event-type calendar selections that referenced calendars under the old source.
This PR adds an Edit affordance on each source row (web) and a `calrs source update` command (CLI). Both are scoped to the current user's sources.
Web
CLI
`calrs source update [--name ...] [--url ...] [--username ...] [--password]`
Notable details
Tests
4 new web handler tests:
583 tests total (up from 579). All green on pre-commit. Clippy clean.
Test plan
Verification gap I'm flagging
I have not driven the Edit button in a real browser. The handler logic is covered by the four unit tests on `update_source` plus the existing template-render tests; the JS-free form is unlikely to surprise. The browser-facing piece worth eyeballing is the post-edit redirect and the password-blank "Leave blank to keep existing" placeholder.
🤖 Generated with Claude Code