-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[WEB-3251] fix: add to projects list API #6550
Conversation
WalkthroughThe changes update how project membership is represented across the codebase. The boolean field Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant PP as ProjectPageRoot
participant NS as useParams Hook
participant SW as useSWR
participant API as fetchProjects API
U->>PP: Load project page
PP->>NS: Retrieve workspaceSlug
PP->>SW: Initiate data fetch with workspaceSlug
SW->>API: Request project data
API-->>SW: Return projects with member_role info
SW-->>PP: Provide data to component
PP->>U: Render updated project page
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip 🌐 Web search-backed reviews and chat
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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)
web/helpers/project.helper.ts (1)
90-90
: Consider validating the member role value.The condition
!project.member_role
only checks for the existence of a role. Consider validating that the role meets minimum permission requirements:- if (displayFilters.my_projects && !project.member_role) fallsInFilters = false; + if (displayFilters.my_projects && (!project.member_role || project.member_role < EUserPermissions.MEMBER)) fallsInFilters = false;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
apiserver/plane/app/serializers/project.py
(0 hunks)apiserver/plane/app/views/project/base.py
(2 hunks)packages/types/src/project/projects.d.ts
(1 hunks)web/ce/components/projects/page.tsx
(1 hunks)web/core/components/project/card.tsx
(7 hunks)web/core/store/project/project.store.ts
(2 hunks)web/helpers/project.helper.ts
(1 hunks)
💤 Files with no reviewable changes (1)
- apiserver/plane/app/serializers/project.py
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (6)
web/ce/components/projects/page.tsx (1)
11-25
: LGTM! Well-structured reactive component with proper data fetching.The changes improve the component by:
- Adding reactive state management with mobx-react
- Implementing efficient data fetching with SWR
- Including proper null checks for dependencies
packages/types/src/project/projects.d.ts (1)
19-19
: LGTM! Type definition properly reflects role-based membership.The change from boolean
is_member
to nullablemember_role: TUserPermissions | null
is a good improvement that provides more granular control over project access.web/core/components/project/card.tsx (1)
66-68
: LGTM! Clear and consistent role-based checks.The changes improve code clarity by:
- Using descriptive role variables
- Implementing consistent role-based checks
- Properly handling different permission levels
web/core/store/project/project.store.ts (2)
218-218
: LGTM! Clean transition from boolean to role-based membership check.The change from
is_member
to!!project.member_role
maintains the same boolean logic while transitioning to the new role-based system.
236-236
: LGTM! Consistent role-based membership check.The change aligns with the
joinedProjectIds
getter, maintaining consistency in how project membership is determined.apiserver/plane/app/views/project/base.py (1)
157-161
: LGTM! Clean transition to role-based membership in API response.The changes correctly:
- Annotate the user's role in the project using a subquery
- Include the role in the API response
Also applies to: 172-172
Description
In this PR, I have removed
is_member
property from the projects API and addedmember_role
instead.Type of Change
References
WEB-3251
Summary by CodeRabbit
New Features
Refactor