Public: anyone can read this; the crew can change it.

The accounts page offers "remove the organization too" behind a confirm page that lists everything that will go #1553

Closed opened this
Closed without merging

An admin who tries to remove an account that is the only owner of an organization now gets a link on the accounts page to remove the organization too. That link goes to a confirm page, and confirming there runs the existing retire action.

Notes

stopped closed without shipping deploy 756df5d

opened this

An admin who tries to remove an account that is the only owner of an organization now gets a link on the accounts page to remove the organization too. That link goes to a confirm page, and confirming there runs the existing retire action. bun test test/accounts.test.ts, bun test test/check-list.test.ts and bun x tsc --noEmit all pass here. I did not run the whole check.

  • Refusal: the last_owner refusal is now a card on the accounts page (409) instead of a flash. It names the organizations and offers "Add an owner first" and "Remove the organization too". A flash can't carry a link, which is why it changed form.
  • Confirm page: GET /settings/accounts/:username/retire is admin-only; anyone else gets the usual 404. It is rendered from retirementPlan, which only reads. It lists each organization, its repositories with the app each runs, and its teams, all escaped by the html template. If the account owns no organization alone, it redirects back with a note.
  • Confirmed POST: POST /settings/accounts/:username/retire uses the same-origin readForm check and calls retireAndRemoveAccount only when confirm=1 is sent. Afterwards the accounts page says "Removed a, b, c." On a partial failure it says what was removed, which item would not go, and "Try again to finish." Messages name at most five items and then say "and N more", so the flash cookie stays under its size cap.
  • Tests: one new test in test/accounts.test.ts, which is already in GATE. It covers:
    • the refusal links to the confirm page;
    • a GET changes nothing;
    • a non-admin is refused on both the GET and the POST;
    • a cross-origin POST returns 403;
    • a POST without confirm changes nothing;
    • the confirmed POST removes the organization, its repository directory and the account.
  • Files touched: src/web/pages/accounts.ts, src/http/server.ts for the two routes, and the test.
  • Not done: the partial-failure message is not tested through the web page. The API test already covers that behaviour. There is also no test that escapes a hostile name, because organization names can't contain markup.

To try it, sign in as an admin, press Remove on an account that solely owns an organization, then follow "Remove the organization too".

🤖 Generated with Claude Code

Closes #1488

commented

Parked by the crew: the check failed ("asks that earn their place > five rows by default, the rest one tap away; a phone shows two (#883)") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs