plane icon indicating copy to clipboard operation
plane copied to clipboard

[WEB-5537]refactor: rename IssueUserProperty to ProjectUserProperty and update related references

Open pablohashescobar opened this issue 4 weeks ago • 4 comments

Description

  • rename IssueUserProperty to ProjectUserProperty
  • add fields sort_order and preferences to ProjectUserProperty
  • migration script for migrating data from ProjectMembers to ProjectUserProperty
  • change references of IssueUserProperty to ProjectUserProperty

Type of Change

  • [x] Improvement (change that would cause existing functionality to not work as expected)
  • [x] Code refactoring

Test Scenarios

  • project workitem grouping and filtering
  • project sorting in the sidebar

References

WEB-5537


[!NOTE] Renames IssueUserProperty to ProjectUserProperty across backend, adds preferences and sort_order with data migrations, updates related endpoints and member flows, and adds allowed_rate_limit to APIToken.

  • Models & Migrations
    • Rename IssueUserPropertyProjectUserProperty (table to project_user_properties), update relations/constraints and serializer names.
    • Add preferences and sort_order to ProjectUserProperty; migrate values from ProjectMember (bulk update).
    • Add APIToken.allowed_rate_limit and migrate existing non-service tokens to null workspace.
    • Remove IssueUserProperty model; expose ProjectUserProperty from db.models.project.
  • API & Endpoints
    • Replace IssueUserDisplayPropertyEndpoint with ProjectUserDisplayPropertyEndpoint at workspaces/<slug>/projects/<project_id>/user-properties/ (partial update via serializer; creates if missing).
    • Update imports/usages in issue/project views, serializers, and URLs to use ProjectUserProperty.
  • Project membership & seeding
    • On project create/member add/invite accept/seed: create ProjectUserProperty records; compute sort_order using member’s workspace min where applicable.
    • ProjectMember.save now auto-creates corresponding ProjectUserProperty with derived sort_order.
    • Management command create_project_member now targets ProjectUserProperty.
  • Tests
    • Contract tests updated to assert creation of ProjectUserProperty for project members.

Written by Cursor Bugbot for commit d75efb3cfd1c896c1c81b113ff7c1da851c6d8b3. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced project-level user preference and member sorting capabilities
  • Refactor

    • Reorganized project property management system for improved data organization and consistency

✏️ Tip: You can customize this high-level summary in your review settings.

pablohashescobar avatar Dec 01 '25 09:12 pablohashescobar

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

makeplane[bot] avatar Dec 01 '25 09:12 makeplane[bot]

[!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

Walkthrough

A refactoring renames and relocates the IssueUserProperty model to ProjectUserProperty in the project module, introduces database schema and data migrations, and updates all related imports, serializers, views, and URL configurations. Sort order calculation logic in project member creation is modified to source from the new model structure.

Changes

Cohort / File(s) Summary
Model Definition & Exports
apps/api/plane/db/models/issue.py, apps/api/plane/db/models/project.py, apps/api/plane/db/models/__init__.py
Removed IssueUserProperty class from issue.py; added ProjectUserProperty class to project.py with fields for preferences, sort_order, filters, and display properties; updated model exports to reflect the move.
Database Migrations
apps/api/plane/db/migrations/0113_alter_issueuserproperty_table.py, apps/api/plane/db/migrations/0114_alter_projectuserproperty_options_and_more.py
Schema migration alters table from issueuserproperty to project_user_properties, adds preferences and sort_order fields, updates constraints; data migration moves existing records and copies preferences/sort_order from ProjectMember to ProjectUserProperty.
View Layer - Project
apps/api/plane/app/views/project/base.py, apps/api/plane/app/views/project/invite.py, apps/api/plane/app/views/project/member.py
Updated all imports and instantiations from IssueUserProperty to ProjectUserProperty; in member.py, refactored sort_order computation to derive minimum from ProjectUserProperty instead of ProjectMember; adjusted field references in bulk create operations.
View Layer - Issue
apps/api/plane/app/views/issue/base.py
Renamed endpoint class from IssueUserDisplayPropertyEndpoint to ProjectUserDisplayPropertyEndpoint; updated model and serializer references from IssueUserProperty to ProjectUserProperty in get/patch logic.
Serializers & Exports
apps/api/plane/app/serializers/issue.py, apps/api/plane/app/serializers/__init__.py
Renamed IssueUserPropertySerializer to ProjectUserPropertySerializer; updated Meta.model reference; adjusted public exports in __init__.py.
URL Routing
apps/api/plane/app/urls/issue.py
Updated endpoint import and URL pattern from IssueUserDisplayPropertyEndpoint to ProjectUserDisplayPropertyEndpoint.
Public Exports
apps/api/plane/app/views/__init__.py
Removed export of IssueUserDisplayPropertyEndpoint; added export of ProjectUserDisplayPropertyEndpoint.
Background Tasks & Management
apps/api/plane/bgtasks/workspace_seed_task.py, apps/api/plane/db/management/commands/create_project_member.py
Updated imports and bulk_create calls to use ProjectUserProperty; removed sort_order computation logic in management command.
Tests
apps/api/plane/tests/contract/app/test_project_app.py
Updated assertions to verify ProjectUserProperty instead of IssueUserProperty in project creation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 A model hops from issue fields so wide,
Now projects claim the property with pride.
Data migrates through the schema's dance,
Sort orders shuffle in their new stance.
From issue_user to project_user we go,
Refactoring complete—watch our codebase grow! 🌱

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.78% 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 title clearly describes the main refactoring work: renaming IssueUserProperty to ProjectUserProperty and updating all related references throughout the codebase.
Description check ✅ Passed The description covers the key changes (rename, new fields, migration, reference updates) and includes required sections like Type of Change, Test Scenarios, and References, though Test Scenarios could be more detailed.
✨ 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 chore-user-property-migrations

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 01 '25 09:12 coderabbitai[bot]

@pablohashescobar Update the ProjectUserProperty Serializers to support updating the additional properties.

sriramveeraghanta avatar Dec 01 '25 13:12 sriramveeraghanta

@pablohashescobar Removed allowed_rate_limit from this PR and added it in this PR

sangeethailango avatar Dec 24 '25 10:12 sangeethailango