[WEB-5537]refactor: rename IssueUserProperty to ProjectUserProperty and update related references
Description
- rename
IssueUserPropertytoProjectUserProperty - add fields
sort_orderandpreferencestoProjectUserProperty - migration script for migrating data from
ProjectMemberstoProjectUserProperty - change references of
IssueUserPropertytoProjectUserProperty
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
[!NOTE] Renames
IssueUserPropertytoProjectUserPropertyacross backend, addspreferencesandsort_orderwith data migrations, updates related endpoints and member flows, and addsallowed_rate_limittoAPIToken.
- Models & Migrations
- Rename
IssueUserProperty→ProjectUserProperty(table toproject_user_properties), update relations/constraints and serializer names.- Add
preferencesandsort_ordertoProjectUserProperty; migrate values fromProjectMember(bulk update).- Add
APIToken.allowed_rate_limitand migrate existing non-service tokens to nullworkspace.- Remove
IssueUserPropertymodel; exposeProjectUserPropertyfromdb.models.project.- API & Endpoints
- Replace
IssueUserDisplayPropertyEndpointwithProjectUserDisplayPropertyEndpointatworkspaces/<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
ProjectUserPropertyrecords; computesort_orderusing member’s workspace min where applicable.ProjectMember.savenow auto-creates correspondingProjectUserPropertywith derivedsort_order.- Management command
create_project_membernow targetsProjectUserProperty.- Tests
- Contract tests updated to assert creation of
ProjectUserPropertyfor 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.
[!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.
Fromissue_usertoproject_userwe 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.
Comment @coderabbitai help to get the list of available commands and usage tips.
@pablohashescobar Update the ProjectUserProperty Serializers to support updating the additional properties.
@pablohashescobar Removed allowed_rate_limit from this PR and added it in this PR