Skip to content

Let Members Leave Projects#421

Merged
cubap merged 18 commits into
developmentfrom
414-members-want-to-leave
Dec 1, 2025
Merged

Let Members Leave Projects#421
cubap merged 18 commits into
developmentfrom
414-members-want-to-leave

Conversation

@thehabes
Copy link
Copy Markdown
Member

@thehabes thehabes commented Nov 26, 2025

Closes #414

This PR implements the ability for members to voluntarily leave projects via a new POST /project/:projectId/leave endpoint. It also adds the removeMember functionality to the Group and Project classes with proper safeguards.

Changes

  • New endpoint: POST /project/:projectId/leave - Allows authenticated members to leave a project
  • Group.removeMember(): New method to remove members from groups with owner protection
  • Group.getGroupsByMember(): New static method to find all groups containing a member
  • Project.removeMember(): Updated to handle voluntary leaving vs admin removal, sends confirmation emails

Features

  • Members can leave projects they belong to
  • Only-OWNER protection prevents orphaning projects (returns 403 with clear message)
  • Confirmation emails sent to removed members (voluntary vs admin removal have different messages)
  • Proper cleanup of temporary/invited users when they have no remaining group memberships

Test Plan

  • Member can leave a project they belong to (200 OK)
  • Request without authentication returns 401
  • Invalid/non-existent project ID returns 404
  • User not a member of project returns 400
  • Only OWNER cannot leave - returns 403 "Transfer ownership first"
  • Admin can remove members via existing /remove-member endpoint
  • App remains stable - no crashes on error conditions

Notes

Does not do #416. That will be its own PR.

@thehabes thehabes linked an issue Nov 26, 2025 that may be closed by this pull request
@thehabes thehabes marked this pull request as ready for review November 26, 2025 22:15
@thehabes thehabes requested a review from Copilot November 26, 2025 22:15
@thehabes thehabes self-assigned this Nov 26, 2025

This comment was marked as outdated.

whitespace in email

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread classes/Project/Project.js Outdated
}

// Prevent removing the only LEADER
if (userRoles.includes("LEADER")) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since OWNER can do everything, I think no LEADER is okay.

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread classes/Project/Project.js Outdated
Comment thread project/memberLeaveRouter.js Outdated
@cubap cubap merged commit 81fb9b5 into development Dec 1, 2025
4 checks passed
@cubap cubap deleted the 414-members-want-to-leave branch December 1, 2025 20:41
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.

Members Cannot Leave Project

3 participants