-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[WEB-3528] fix: correct member id in modules list showing deleted_at members #7777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: preview
Are you sure you want to change the base?
Conversation
WalkthroughThe queryset in ModuleViewSet was modified by removing select_related on project, workspace, and lead. The ArrayAgg for member_ids now filters to include only non-null, non-deleted member IDs via modulemember__deleted_at__isnull=True. Changes
Sequence Diagram(s)sequenceDiagram
actor Client
participant API as ModuleViewSet
participant DB as Database
Client->>API: GET /modules
API->>API: build queryset (no select_related on project/workspace/lead)
API->>DB: Query modules + ArrayAgg(member_ids where not null and not deleted)
DB-->>API: Result set
API-->>Client: JSON response
Note over API: member_ids only for active members
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Poem
✨ 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. Comment |
Pull Request Linked with Plane Work Items References Comment Automatically Generated by Plane |
There was a problem hiding this 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 fixes a bug where deleted module members were still appearing in the modules list response. The change filters out module members with a deleted_at
timestamp to ensure only active members are returned.
- Modified the
member_ids
annotation to exclude deleted module members - Removed unnecessary
select_related
calls for optimization
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/api/plane/app/views/module/base.py (1)
315-318
: Make member_ids ordering deterministic.Without an explicit ordering, Postgres can return arrays in arbitrary order, causing flaky diffs/tests. Consider ordering by member ID.
Apply:
ArrayAgg( "members__id", distinct=True, filter=Q( members__id__isnull=False, modulemember__deleted_at__isnull=True, ), + ordering=("members__id",), )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/api/plane/app/views/module/base.py
(1 hunks)
⏰ 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). (1)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/api/plane/app/views/module/base.py (2)
315-318
: Fix aligns with WEB-3528: soft-deleted memberships are excluded from member_ids.Using ArrayAgg with a filtered join on modulemember__deleted_at__isnull=True correctly omits removed members; Coalesce to a typed empty UUID array is also right. Distinct avoids dupes. LGTM.
315-318
: Confirm through model & field names for members lookupfilter=Q( members__id__isnull=False, modulemember__deleted_at__isnull=True, ),
Search didn't find model files (plane/db/models missing) — only this usage at apps/api/plane/app/views/module/base.py:317. Confirm Module.members uses ModuleMember as the through model and that ModuleMember defines deleted_at (or that the through model's reverse related_name matches "modulemember"); if not, update the lookup to the actual related_name/field.
Description
fix: correct member_ids in modules list to filter out deleted_at module members from the response
Type of Change
Test Scenarios
References
WEB-3528
Summary by CodeRabbit