fix: Consistently remove a member from organization/sub-team/team - through all the APIs and webapp actions#22806
Conversation
WalkthroughThe PR centralizes member-removal into TeamService.removeMembers, refactors deletion flows to fetch memberships and throw NotFound when absent, and replaces direct repository deletes with calls to TeamService (isOrg flag supported). It removes the legacy removeMember utility and a TeamsEventTypesService method, updates API v2 services/controllers to call TeamService, adds integration tests for TeamService.removeMembers, adds small test fixtures, and exports TeamService from platform libraries. Non-functional tweaks (imports/formatting) and a deleted skipped TRPC test were also included. Assessment against linked issues
Out-of-scope changes
Possibly related PRs
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (1)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
E2E results are ready! |
…embership-deletion
8069a94 to
262ffe4
Compare
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
5f8035e to
fe77f51
Compare
fe77f51 to
881ba5d
Compare
881ba5d to
5cd93f3
Compare
…ic methods - Moved removeMember and all related helper functions from separate file into TeamService class - Made all functions private static methods instead of exporting them - Deleted the original removeMember.ts file since it's no longer needed - Updated imports to use the new location - All integration tests pass successfully
- Renamed memberId parameter to userId in removeMember private method - Renamed memberIds parameter to userIds in removeMembers public method - Updated all calls to removeMembers to use userIds instead of memberIds - Parameter names now accurately reflect that they are user IDs, not membership IDs
…letion - Add unit tests for membership deletion services - Remove redundant deletion behavior tests from controllers - Keep only happy path tests in e2e controller tests - Fix unused imports and variables
baf51ea to
3fef285
Compare
|
@ThyMinimalDev could you publish a new version with the changes, I took the latest merge of main which had bumped platform libraries and the API V2 build started failing again @alishaz-polymath replied to your feedback. |
keithwillcode
left a comment
There was a problem hiding this comment.
Approving since previously approved and libraries were bumped
What does this PR do?
This PR fixes the organization membership deletion functionality in API V2 by properly calling the TeamService.removeMembers method instead of directly deleting the membership record. This ensures that all necessary cleanup operations are performed when removing a user from an organization.
Fixes PRI-297
Bug Fixes
Technical Details:
TeamService.removeMembers({ teamIds: [organizationId], userIds: [membership.userId], isOrg: true })Visual Demo (For contributors especially)
N/A - This is a backend API change with no visual components.
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Prerequisites:
Testing Steps:
Checklist