feat: allow owner to toggle collaborator permissions in ShareDialog#59
feat: allow owner to toggle collaborator permissions in ShareDialog#59
Conversation
There was a problem hiding this comment.
Pull request overview
Adds owner-only support for changing an existing collaborator’s permission (view/edit) from the Share dialog, backed by a new backend PATCH endpoint.
Changes:
- Backend: add
PATCH /api/canvases/{canvas_id}/collaborators/{collab_user_id}to update a collaborator’s permission (owner-only). - Frontend API client: add
canvasAPI.updateCollaboratorPermission()wrapper for the new endpoint. - UI: replace the collaborator permission badge with an inline toggle button that flips view/edit and updates local state.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/lib/api/backendClient.ts | Adds an API helper to call the new collaborator-permission PATCH endpoint. |
| frontend/components/canvas/ShareDialog.tsx | Adds permission-toggle UI and handler to update a collaborator’s permission inline. |
| backend/app/api/routes/canvases.py | Introduces request model + owner-only PATCH route to update canvas_collaborators.permission. |
There was a problem hiding this comment.
Pull request overview
Adds an owner-only capability to change an existing collaborator’s permission (view/edit) from the Share dialog, backed by a new backend PATCH endpoint and corresponding frontend API call.
Changes:
- Backend: introduce
UpdateCollaboratorRequestand addPATCH /api/canvases/{canvas_id}/collaborators/{collab_user_id}(owner-only) to update a collaborator’s permission. - Frontend: add
canvasAPI.updateCollaboratorPermission()and updateShareDialogto toggle a collaborator’s permission inline. - Tests: add route-level pytest coverage for the new PATCH endpoint (success, forbidden, not-found).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| frontend/lib/api/backendClient.ts | Adds a typed client wrapper for the new collaborator-permission PATCH endpoint. |
| frontend/components/canvas/ShareDialog.tsx | Adds a click-to-toggle UI to flip collaborator permission between view/edit. |
| backend/app/api/routes/canvases.py | Adds request model + owner-only PATCH route to update collaborator permissions. |
| backend/tests/api/routes/test_api_canvases_full.py | Adds tests for success/403/404 behaviors of the new endpoint. |
…ing and aria-pressed
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end support for canvas owners to toggle a collaborator’s permission between view and edit directly from the Share dialog, backed by a new owner-only backend PATCH endpoint and a frontend API wrapper.
Changes:
- Added
PATCH /api/canvases/{canvas_id}/collaborators/{collab_user_id}(owner-only) to update a collaborator’s permission incanvas_collaborators. - Added
canvasAPI.updateCollaboratorPermission()to call the new endpoint. - Updated
ShareDialogto replace the static permission badge with an inline, disabled-while-updating permission toggle button.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/lib/api/backendClient.ts | Adds a typed client method to PATCH collaborator permission. |
| frontend/components/canvas/ShareDialog.tsx | Adds UI + handler/state for inline permission toggling per collaborator. |
| backend/app/api/routes/canvases.py | Adds request model and owner-only PATCH route to update collaborator permission. |
| backend/tests/api/routes/test_api_canvases_full.py | Adds tests for success/403/404 cases of the new PATCH route. |
Description
Users can change shared permissions.
Type of Change
Related Issues
Closes #58
Changes Made
Checklist
Additional Context
N/A