[WEB-4338] fix: incorrect error code in project retrieve API
Description
This PR will fix the incorrect error code in the project retrieve API.
Type of Change
- [x] Bug fix (non-breaking change which fixes an issue)
[!NOTE]
Other AI code review bot(s) detected
CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.
Walkthrough
API now enforces membership checks with network-type-specific errors; web routing moved to projectId-based layouts; ProjectAuthWrapper made projectId required and replaced JoinProject with ProjectAccessRestriction; multiple UI loading spinners removed; new i18n keys added for project access/invalid states.
Changes
| Cohort / File(s) | Summary |
|---|---|
API Project Viewapps/api/plane/app/views/project/base.py |
Adjusted imports; retrieve() now fetches project then verifies membership via project.members_list; returns 403 for SECRET-network projects or 409 for non-members; calls recent_visited_task.delay with additional args. |
Model Exportsapps/api/plane/db/models/__init__.py |
Re-exported ProjectNetwork. |
Project Auth Wrapper (web)apps/web/core/layouts/auth-layout/project-wrapper.tsx, apps/web/ce/layouts/project-wrapper.tsx |
Made projectId required; centralized access control to ProjectAccessRestriction; added join-project workflow and isProjectLoading handling; removed prior JoinProject/EmptyState flows. |
Routing Restructureapps/web/app/routes/core.ts |
Reworked routes to use /:projectId-based layouts, centralized archives, added intake and automations nested layouts, and reorganized project settings paths. |
Project Settings UIapps/web/app/(all)/[workspaceSlug]/(settings)/settings/projects/layout.tsx, apps/web/app/(all)/[workspaceSlug]/(settings)/settings/projects/[projectId]/layout.tsx, apps/web/app/(all)/[workspaceSlug]/(settings)/settings/projects/[projectId]/page.tsx, apps/web/app/(all)/[workspaceSlug]/(settings)/settings/projects/page.tsx |
Added new project-specific settings layout; removed SWR fetch from page; simplified rendering guards; added observer wrappers and theme-based assets. |
Project Wrapper for Nested Routesapps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/layout.tsx |
Wrapped nested Outlet with ProjectAuthWrapper to require project authorization. |
Removed Join UI / Added Access Restrictionapps/web/core/components/auth-screens/project/join-project.tsx (removed), apps/web/core/components/auth-screens/project/project-access-restriction.tsx (added) |
Deleted JoinProject component; added ProjectAccessRestriction component that renders different EmptyStateDetailed views and a join CTA based on errorStatusCode and admin status. |
Removed LogoSpinner Loading Pathsapps/web/core/components/issues/issue-layouts/roots/*.tsx, apps/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx, apps/web/core/components/workspace/settings/workspace-details.tsx, apps/web/app/(all)/[workspaceSlug]/(settings)/settings/account/*.tsx |
Removed LogoSpinner imports and spinner UIs; consolidated guards to return empty fragment until required identifiers/filters/data exist; updated SWR fetchers to call fetchFilters where applicable. |
Project Service Error Shapeapps/web/core/services/project/project.service.ts |
getProject now rethrows error.response (the full response) instead of error.response.data. |
Browse Page Guard Tighteningapps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/page.tsx |
EmptyState now shown only when error && !issueLoader to avoid displaying during loading. |
i18n โ project_empty_state additionspackages/i18n/src/locales/*/empty-state.ts (en, cs, de, es, fr, id, it, ja, ko, pl, pt-BR, ro, ru, sk, tr-TR, ua, vi-VN, zh-CN, zh-TW) |
Added project_empty_state.no_access (title, restricted_description, join_description, cta_primary, cta_loading) and project_empty_state.invalid_project (title, description) across locales. |
Estimated code review effort
๐ฏ 4 (Complex) | โฑ๏ธ ~45โ75 minutes
Key attention areas:
apps/api/plane/app/views/project/base.pyโ membership validation and HTTP status selection for SECRET vs non-secret networks.apps/web/core/layouts/auth-layout/project-wrapper.tsxโ new ProjectAccessRestriction integration, join flow, and loading/error handling.apps/web/app/routes/core.tsโ verify route relocations and no missing paths.- i18n additions โ ensure keys match usages in new access-restriction UI.
Possibly related PRs
- makeplane/plane#8021 โ overlaps on empty-state i18n keys and empty-state UI usage; likely complementary changes to project_empty_state translations.
Suggested reviewers
- vamsikrishnamathala
- prateekshourya29
Poem
๐ฐ I hopped through routes and guards today,
projects checked, secrets kept at bay.
No spinning logos on the way,
New messages guide the lost astray.
A join-button winked โ hop in, hooray!
Pre-merge checks and finishing touches
โ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | โ ๏ธ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
โ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | โ Passed | The PR title '[WEB-4338] fix: incorrect error code in project retrieve API' clearly summarizes the main change: fixing error codes in the project retrieve API endpoint. |
| Description check | โ Passed | The PR description includes the required 'Description' section explaining the fix, 'Type of Change' with 'Bug fix' selected, and references the broader impact with detailed notes on backend and frontend changes. |
โจ Finishing touches
- [ ] ๐ Generate docstrings
๐งช Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
fix-project-status-code
[!TIP]
๐ Customizable high-level summaries are now available in beta!
You can now customize how CodeRabbit generates the high-level summary in your pull requests โ including its content, structure, tone, and formatting.
- Provide your own instructions using the
high_level_summary_instructionssetting.- Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
- Use
high_level_summary_in_walkthroughto move the summary from the description to the walkthrough section.Example instruction:
"Divide the high-level summary into five sections:
- ๐ Description โ Summarize the main change in 50โ60 words, explaining what was done.
- ๐ References โ List relevant issues, discussions, documentation, or related PRs.
- ๐ฆ Dependencies & Requirements โ Mention any new/updated dependencies, environment variable changes, or configuration updates.
- ๐ Contributor Summary โ Include a Markdown table showing contributions:
| Contributor | Lines Added | Lines Removed | Files Changed |- โ๏ธ Additional Notes โ Add any extra reviewer context. Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.
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 @coderabbitai help to get the list of available commands and usage tips.