-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[WEB-4722]fix: fixed draft state update #7663
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
Conversation
WalkthroughAdds project_id fallback logic in DraftIssue partial_update: uses request.data project_id if provided, else the issue’s existing project_id when building serializer context. No signature changes; response codes and overall flow unchanged. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant V as DraftView.partial_update
participant DB as DB: Issue
participant S as DraftIssueCreateSerializer
C->>V: PATCH /workspaces/{slug}/drafts/{pk}
V->>DB: Fetch Issue by pk
alt Issue not found
V-->>C: 404 Not Found
else Issue found
V->>V: project_id = request.data.project_id or issue.project_id
V->>S: Instantiate with context{ project_id, cycle_id }
S->>S: validate()
alt valid
S->>DB: save()
V-->>C: 204 No Content
else invalid
V-->>C: 400 Bad Request (errors)
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
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. 🪧 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 (
|
|
Pull Request Linked with Plane Work Items
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/api/plane/app/views/workspace/draft.py (1)
182-184: Consider passing workspace_id in context for parity and future-proofing.Not strictly required per current validators, but cheap and keeps parity with create(). Low risk since it’s read-only for update flows.
context={ - "project_id": project_id, + "project_id": context_project_id, + "workspace_id": issue.workspace_id, "cycle_id": request.data.get("cycle_id", "not_provided"), },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/api/plane/app/views/workspace/draft.py(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: NarayanBavisetti
PR: makeplane/plane#7460
File: apps/api/plane/app/serializers/draft.py:112-122
Timestamp: 2025-07-23T18:18:06.875Z
Learning: In the Plane codebase serializers, workspace_id is not consistently passed in serializer context, so parent issue validation in DraftIssueCreateSerializer only checks project_id rather than both workspace_id and project_id. The existing project member authentication system already validates that users can only access projects they belong to, providing sufficient security without risking breaking functionality by adding workspace_id validation where the context might not be available.
📚 Learning: 2025-07-23T18:18:06.875Z
Learnt from: NarayanBavisetti
PR: makeplane/plane#7460
File: apps/api/plane/app/serializers/draft.py:112-122
Timestamp: 2025-07-23T18:18:06.875Z
Learning: In the Plane codebase serializers, workspace_id is not consistently passed in serializer context, so parent issue validation in DraftIssueCreateSerializer only checks project_id rather than both workspace_id and project_id. The existing project member authentication system already validates that users can only access projects they belong to, providing sufficient security without risking breaking functionality by adding workspace_id validation where the context might not be available.
Applied to files:
apps/api/plane/app/views/workspace/draft.py
🧬 Code graph analysis (1)
apps/api/plane/app/views/workspace/draft.py (2)
apps/api/plane/tests/unit/bg_tasks/test_copy_s3_objects.py (1)
issue(25-31)apps/api/plane/app/serializers/draft.py (1)
DraftIssueCreateSerializer(31-309)
⏰ 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 (1)
apps/api/plane/app/views/workspace/draft.py (1)
167-185: Ignore cross-project mismatch concern in partial_update. The serializer’s update method always usesinstance.project_idfor all related writes, so any user-suppliedproject_idin the context is never applied—no cross-project integrity issue.Likely an incorrect or invalid review comment.
Description
This PR fixes an issue with state validation in draft issues where the project context was not being properly maintained during updates. The changes ensure consistent state validation behaviour between regular issues and draft issues.
project_idcontext handling inDraftIssueCreateSerializerfor partial updatesproject_idwhen no newproject_idis provided in the requestType of Change
Screenshots and Media (if applicable)
Screen.Recording.2025-08-28.at.2.31.43.PM.mov
Summary by CodeRabbit