Skip to content

feat: allow owner to toggle collaborator permissions in ShareDialog#59

Merged
calebyhan merged 3 commits intomainfrom
feature/change-shared-permissions
Mar 17, 2026
Merged

feat: allow owner to toggle collaborator permissions in ShareDialog#59
calebyhan merged 3 commits intomainfrom
feature/change-shared-permissions

Conversation

@calebyhan
Copy link
Owner

Description

Users can change shared permissions.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔨 Refactoring (no functional changes)
  • ✅ Test additions or updates
  • 🔧 Configuration/build changes

Related Issues

Closes #58

Changes Made

  • Added UpdateCollaboratorRequest Pydantic model
  • Added PATCH /api/canvases/{canvas_id}/collaborators/{collab_user_id} — owner-only endpoint that updates a collaborator's permission in the canvas_collaborators table
  • Added canvasAPI.updateCollaboratorPermission() calling the new PATCH endpoint
  • Added handleUpdatePermission handler
  • Replaced the static Badge with a clickable toggle button — clicking it flips the collaborator's permission between view/edit inline, with distinct styling for each state

Checklist

  • My code follows the project's style guidelines (PEP 8 for Python, ESLint for TypeScript)
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Context

N/A


Copilot AI review requested due to automatic review settings March 17, 2026 21:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 UpdateCollaboratorRequest and add PATCH /api/canvases/{canvas_id}/collaborators/{collab_user_id} (owner-only) to update a collaborator’s permission.
  • Frontend: add canvasAPI.updateCollaboratorPermission() and update ShareDialog to 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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in canvas_collaborators.
  • Added canvasAPI.updateCollaboratorPermission() to call the new endpoint.
  • Updated ShareDialog to 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.

@calebyhan calebyhan merged commit 6c15952 into main Mar 17, 2026
10 checks passed
@calebyhan calebyhan deleted the feature/change-shared-permissions branch March 17, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: change shared permissions

2 participants