mirror of
https://github.com/screentinker/screentinker.git
synced 2026-06-15 10:43:36 -06:00
Extends the shared add-user modal (workspace-members-add-user-modal.js) with an optional picker mode instead of forking a second form: - opened with a fixed workspace (members view) -> unchanged, no picker; - opened with null (platform Users admin page) -> shows an Org/Workspace picker (type-to-filter over /me's accessible_workspaces, labelled "org / workspace") plus the role select; email/name/password+generate/ must-change/error-mapping stay shared. Role options are rendered from a single WORKSPACE_ROLES constant that mirrors the set POST /api/admin/users accepts (routes/admin.js) - so we never offer a value the endpoint 400s (the platform_operator mismatch we already hit). org_admin is intentionally NOT offered: the endpoint accepts only the three workspace roles. admin.js: "Add user" button in the page header (page is already platform_admin-gated; the endpoint additionally enforces canAdminWorkspace, which platform_admin passes everywhere). On success -> toast + refresh the user list. Reuses workspace-members.js's mapMutationError. EN i18n only. Frontend only - no backend change. Verified headless (Playwright): button opens the modal, picker lists all 45 workspaces with working filter, role options = [viewer, editor, admin], and submit created + assigned a user into the chosen workspace (test row cleaned up afterward). npm test still 12/12. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| toast.js | ||
| workspace-members-add-user-modal.js | ||
| workspace-members-invite-modal.js | ||
| workspace-rename-modal.js | ||
| workspace-switcher.js | ||