feat(portal_users): bulk-delete customer portal users from the admin list - #196
Open
pat-lewczuk wants to merge 1 commit into
Open
pat-lewczuk wants to merge 1 commit into
pat-lewczuk wants to merge 1 commit into
Conversation
…list The Customer Users screen (backend -> Customer Portal -> Customer Users) could only delete one account at a time through the row menu, which does not scale when cleaning up participants after an event. Add an app module that injects a bulk action into the core table via UMES instead of ejecting customer_accounts. Injecting a bulk action is what makes DataTable turn on row selection, so the checkboxes and the "Delete selected" button appear together. - portal_users.injection.users-bulk-delete targets the spot data-table:customer_accounts.admin.users:bulk-actions - gated on the existing core feature customer_accounts.manage, the same one the DELETE endpoint enforces, so no new ACL feature to grant - deletes through the core endpoint per user, carrying the optimistic-lock header built from each row's updatedAt, so stale deletes are still refused and session revocation plus the deleted event still run - the core page keeps its rows in client state and exposes no refresh callback to widgets, so the action reloads through the URL and hands the result to FlashMessages via the query string - partial failures report how many were deleted and why the rest were not Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLqyzgTthFCZsqQWE9gh4a
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
Backend → Portal klienta → Użytkownicy klientów could only delete one account at a time, through the row menu. After an event that means clicking through participants one by one.
What changed
A new app module
portal_usersinjects a bulk action into the core table with UMES — no eject ofcustomer_accounts, no patchednode_modules.portal_users.injection.users-bulk-deletetargetsdata-table:customer_accounts.admin.users:bulk-actions.DataTablesetenableRowSelection, so the row checkboxes and the Delete selected button appear together — no change needed in the core page.customer_accounts.manage, the same oneDELETE /api/customer_accounts/admin/users/<id>enforces, so there is no new ACL feature to declare, grant and sync.updatedAt. That keeps everything the single-row path gives you: stale deletes refused, sessions revoked,customer_accounts.user.deletedemitted. Sequential on purpose — an admin list is small and each delete does real work server-side.One wrinkle worth reviewing
The core users page keeps its rows in client state (
reloadToken) and passes norefreshButton, so an injected widget gets norefreshcallback androuter.refresh()would not refetch the list. The action therefore reloads through the URL and passes its message toFlashMessagesvia the?flash=&type=query string — the same mechanismCrudForm'ssuccessRedirectuses. It returns{ ok: false }with no message so the table does not also flash its own.Testing
yarn generateregisters the widget and the injection table (verified in.mercato/generated/injection-widgets.generated.tsandinjection-tables.generated.ts).yarn typecheckpasses./api/customer_accounts/admin/users→ 401,/backend/customer_accounts/users→ 307. Nothing 500s on boot.localhost, so selecting rows and running the delete needs a manual pass: check the checkboxes appear, the confirm text counts correctly, the list reloads, and a partial failure reports sensibly.yarn lintis broken in this repo independently of this change (next lintwas removed in Next 15).🤖 Generated with Claude Code
https://claude.ai/code/session_01VLqyzgTthFCZsqQWE9gh4a