-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[WEB-3285] fix: creating and updating duplicate quick links #6557
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
WalkthroughThis pull request adds two new methods, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Serializer
participant DB
User->>Serializer: call create(validated_data)
Serializer->>DB: check for existing link (URL, workspace, owner)
DB-->>Serializer: return result
alt Link exists
Serializer->>User: raise ValidationError ("URL already exists for this workspace and owner.")
else No duplicate found
Serializer->>DB: create new WorkspaceUserLink
DB-->>Serializer: confirmation
Serializer->>User: return new instance
end
sequenceDiagram
participant User
participant Serializer
participant DB
User->>Serializer: call update(instance, validated_data)
Serializer->>DB: check for duplicate link (excluding current instance)
DB-->>Serializer: return result
alt Duplicate found
Serializer->>User: raise ValidationError ("URL already exists for this workspace and owner.")
else No duplicate found
Serializer->>DB: update WorkspaceUserLink instance
DB-->>Serializer: confirmation
Serializer->>User: return updated instance
end
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip 🌐 Web search-backed reviews and chat
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🪛 Ruff (0.8.2)apiserver/plane/app/serializers/workspace.py151-151: Line too long (97 > 88) (E501) 168-168: Line too long (97 > 88) (E501) ⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (2)
✨ 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: 2
🧹 Nitpick comments (1)
apiserver/plane/app/serializers/workspace.py (1)
133-147: Standardize error message format.The error message format is inconsistent between validation methods:
validate_urlreturns{"error": "Invalid URL format."}- New methods return
{"error": "URL already exists for this Issue"}Consider standardizing the error message format:
- raise serializers.ValidationError({"error": "Invalid URL format."}) + raise serializers.ValidationError("Invalid URL format.")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apiserver/plane/app/serializers/workspace.py(1 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
apiserver/plane/app/serializers/workspace.py
151-151: Line too long (125 > 88)
(E501)
161-161: Line too long (103 > 88)
(E501)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (1)
apiserver/plane/app/serializers/workspace.py (1)
149-170: Implementation successfully addresses duplicate link handling.The added validation logic in both
createandupdatemethods effectively prevents duplicate links within the same workspace and owner context, which aligns perfectly with the PR objectives.🧰 Tools
🪛 Ruff (0.8.2)
151-151: Line too long (125 > 88)
(E501)
161-161: Line too long (103 > 88)
(E501)
Description
This PR will fix creating/updating duplicate quick links.
Summary by CodeRabbit