Org policies: New policy edits the open policy, and renaming on edit writes a second policy #1730

Closed
opened 2026-11-02 04:12:20 +00:00 by sam · 2 comments
Owner

In ui/src/org/OrgAccessPage.vue, the New policy button (:111) only sets editing = true. It does not reset draft, so with policy X open the form still holds X, and Save overwrites X. Choosing Edit on another row (:73-76) drops unsaved edits without asking.

The policy id stays editable while editing (:139-159), so changing it writes a new policy and leaves the original in place.

Done when: New policy opens a blank draft, the id is read-only when editing an existing policy, and leaving a dirty draft asks first.

In `ui/src/org/OrgAccessPage.vue`, the New policy button (`:111`) only sets `editing = true`. It does not reset `draft`, so with policy X open the form still holds X, and Save overwrites X. Choosing Edit on another row (`:73-76`) drops unsaved edits without asking. The policy id stays editable while editing (`:139-159`), so changing it writes a new policy and leaves the original in place. Done when: New policy opens a blank draft, the id is read-only when editing an existing policy, and leaving a dirty draft asks first.
sam added the highbug labels 2026-11-02 04:12:20 +00:00
sam self-assigned this 2026-11-02 04:12:20 +00:00
Author
Owner

Fixed in a2c63415 and pushed. New policy calls newPolicy(), which resets draft+snapshot and opens a blank form — it no longer reuses the open policy's draft, so Save can't overwrite it. The id Input is :readonly="editingExisting", so editing an existing policy can't write a second one on rename. edit()/newPolicy()/cancel() all go through openForm(): when the draft differs from its snapshot (dirty computed), a Discard-unsaved-changes AlertDialog asks first; confirming runs the pending action. Verified: task check exited 0 on the committed tree (vue-tsc typecheck, pnpm test, vite build, go gate).

Fixed in a2c63415 and pushed. New policy calls newPolicy(), which resets draft+snapshot and opens a blank form — it no longer reuses the open policy's draft, so Save can't overwrite it. The id Input is :readonly="editingExisting", so editing an existing policy can't write a second one on rename. edit()/newPolicy()/cancel() all go through openForm(): when the draft differs from its snapshot (dirty computed), a Discard-unsaved-changes AlertDialog asks first; confirming runs the pending action. Verified: task check exited 0 on the committed tree (vue-tsc typecheck, pnpm test, vite build, go gate).
Author
Owner

Fixed in a2c63415 and pushed to main. Gate: task check exited 0 on the committed tree.

Fixed in a2c63415 and pushed to main. Gate: task check exited 0 on the committed tree.
sam closed this issue 2026-11-07 06:09:25 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1730