Skip to content
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

feat: user preference url and sort order change #6505

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

sangeethailango
Copy link
Collaborator

@sangeethailango sangeethailango commented Jan 29, 2025

Description

This PR will modify the URL and will return different sort orders of side bar user preference

Summary by CodeRabbit

  • New Features

    • Updated user preference keys in workspace settings
    • Added new preference options for Projects and Analytics
  • Refactor

    • Modified URL paths for sidebar preferences
    • Adjusted handling of user preference keys

Copy link
Contributor

coderabbitai bot commented Jan 29, 2025

Walkthrough

The pull request introduces changes to the workspace user preferences system in a Django application. The modifications involve renaming URL paths from "user-preferences" to "sidebar-preferences", updating the UserPreferenceKeys enumeration by adding PROJECTS and ANALYTICS choices, and modifying the preference key creation logic to exclude the "projects" key. These changes refine the handling of workspace user preferences without fundamentally altering the core functionality.

Changes

File Change Summary
apiserver/plane/app/urls/workspace.py Renamed URL paths for user preferences from "user-preferences" to "sidebar-preferences"
apiserver/plane/app/views/workspace/user_preference.py Modified preference key creation to exclude "projects" key
apiserver/plane/db/models/workspace.py Updated UserPreferenceKeys enumeration with new PROJECTS and ANALYTICS choices

Possibly related PRs

Suggested labels

📡api, ⚙️backend

Suggested reviewers

  • pablohashescobar
  • NarayanBavisetti

Poem

🐰 Hop, hop, through preferences new,
Sidebar paths with keys so true,
Projects filtered, analytics bright,
CodeRabbit's changes take their flight!
A dance of routes, both swift and light 🚀

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sorry, something went wrong.

@sangeethailango sangeethailango self-assigned this Jan 29, 2025
@sangeethailango sangeethailango marked this pull request as ready for review January 29, 2025 11:09
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🔭 Outside diff range comments (1)
apiserver/plane/app/views/workspace/user_preference.py (1)

Line range hint 41-49: Fix indentation of bulk_create operation.

The bulk_create operation is incorrectly indented and should be outside the for loop to avoid redundant operations.

-                preference = WorkspaceUserPreference.objects.bulk_create(
-                    [
-                        WorkspaceUserPreference(
-                            key=key, user=request.user, workspace=workspace
-                        )
-                        for key in create_preference_keys
-                    ],
-                    batch_size=10,
-                    ignore_conflicts=True,
-                )
+        preference = WorkspaceUserPreference.objects.bulk_create(
+            [
+                WorkspaceUserPreference(
+                    key=key, user=request.user, workspace=workspace
+                )
+                for key in create_preference_keys
+            ],
+            batch_size=10,
+            ignore_conflicts=True,
+        )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f4af78c and 3f5f8b2.

📒 Files selected for processing (3)
  • apiserver/plane/app/urls/workspace.py (1 hunks)
  • apiserver/plane/app/views/workspace/user_preference.py (1 hunks)
  • apiserver/plane/db/models/workspace.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apiserver/plane/app/urls/workspace.py
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint-apiserver
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apiserver/plane/db/models/workspace.py (1)

395-396: Verify the intention behind enum value changes.

The PROJECTS and ANALYTICS choices were removed and re-added in the same position. If this change was intended to modify the sort order, consider:

  1. Adding a comment explaining the rationale
  2. Using the sort_order field instead of relying on enum order
✅ Verification successful

No issues with enum value changes

The removal and re-addition of PROJECTS and ANALYTICS enum values in the same position:

  • Maintains a logical grouping (main sections followed by features)
  • Doesn't affect functionality as TextChoices uses string values
  • Has proper sort_order fields available for explicit ordering when needed
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if these enum values were previously defined in a different order
git log -p -- apiserver/plane/db/models/workspace.py | grep -A 5 -B 5 "PROJECTS = \|ANALYTICS ="

Length of output: 0


Script:

#!/bin/bash
# Get the complete enum definition and surrounding context
echo "=== Enum Definition ==="
ast-grep --pattern 'class UserPreferenceKeys$$$' apiserver/plane/db/models/workspace.py

# Check for any sort_order field in the model
echo -e "\n=== Sort Order Fields ==="
rg "sort_order" apiserver/plane/db/models/workspace.py

# Look for usages of these enum values
echo -e "\n=== Enum Value Usage ==="
rg "PROJECTS.*ANALYTICS|ANALYTICS.*PROJECTS" --type py

Length of output: 490


Script:

#!/bin/bash
# Get the enum definition with a simpler pattern
echo "=== Enum Definition ==="
rg -A 10 -B 2 "class UserPreferenceKeys" apiserver/plane/db/models/workspace.py

Length of output: 546

@sriramveeraghanta sriramveeraghanta merged commit 8f5ce6b into preview Jan 30, 2025
20 of 22 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-user-preference-api-url-changes branch January 30, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants