-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[WEB-4566] feat: add background color and goals field to Profile and Workspace models #7485
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
|
Caution Review failedThe pull request is closed. WalkthroughThe changes introduce a new utility function for generating random hex color strings and add a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ 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. 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 (
|
|
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: 0
🧹 Nitpick comments (2)
apps/api/plane/utils/color.py (1)
9-9: Consider using consistent hex color casing.The current implementation uses
string.hexdigitswhich includes both uppercase and lowercase characters, potentially generating inconsistent hex colors like "#a1B2c3". Consider using only lowercase hex digits for consistency.- return "#" + "".join(random.choices(string.hexdigits, k=6)) + return "#" + "".join(random.choices(string.hexdigits[:16], k=6))Or for explicit lowercase:
- return "#" + "".join(random.choices(string.hexdigits, k=6)) + return "#" + "".join(random.choices("0123456789abcdef", k=6))apps/api/plane/db/models/user.py (1)
225-225: Consider using lambda for mutable default.Using
default=dictcan potentially cause issues where all instances share the same dictionary object. While Django typically handles this correctly by calling the callable for each instance, it's safer to use a lambda.- goals = models.JSONField(default=dict) + goals = models.JSONField(default=lambda: {})
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/api/plane/db/models/user.py(2 hunks)apps/api/plane/db/models/workspace.py(3 hunks)apps/api/plane/utils/color.py(1 hunks)
🔇 Additional comments (5)
apps/api/plane/db/models/user.py (2)
18-18: Import looks good.Clean import of the new utility function.
226-226: Background color field implementation looks correct.The field correctly uses
get_random_coloras a callable default, which will generate a unique random color for each new Profile instance.apps/api/plane/db/models/workspace.py (3)
3-3: Good import cleanup.Removing unused imports and reducing the typing imports to only what's needed improves code cleanliness.
13-13: Import correctly added.Clean import of the new utility function, consistent with the Profile model.
137-137: Background color field implementation is consistent and correct.The field implementation matches the Profile model exactly, providing consistent behavior across both models. The use of
get_random_coloras a callable default will generate unique colors for each workspace.
Description
feat: add background color and goals field to Profile and Workspace models
Type of Change
Test Scenarios
/api/users/me/References
WEB-4566
Summary by CodeRabbit