Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
pablohashescobar wants to merge8 commits intopreview
base:preview
Choose a base branch
Loading
fromchore-user-property-migrations
Open
Show file tree
Hide file tree
Changes from3 commits
Commits
Show all changes
8 commits
Select commitHold shift + click to select a range
6a09e51
refactor: rename IssueUserProperty to ProjectUserProperty and update …
pablohashescobarDec 1, 2025
e43d9b6
migrate: move issue user properties to project user properties and up…
pablohashescobarDec 1, 2025
f75d40f
Merge branch 'preview' of github.com:makeplane/plane into chore-user-…
pablohashescobarDec 1, 2025
d874227
refactor: rename IssueUserPropertySerializer and IssueUserDisplayProp…
pablohashescobarDec 1, 2025
280c3ce
fix: enhance ProjectUserDisplayPropertyEndpoint to handle missing pro…
pablohashescobarDec 1, 2025
e7cf8fa
fix: correct formatting in migration for ProjectUserProperty model op…
pablohashescobarDec 3, 2025
2f0ea09
migrate: add migration to update existing non-service API tokens to r…
pablohashescobarDec 8, 2025
ab9a6b4
migrate: refine migration to update existing non-service API tokens b…
pablohashescobarDec 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some comments aren't visible on the classic Files Changed page.

6 changes: 3 additions & 3 deletionsapps/api/plane/api/views/project.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
from plane.db.models import (
Cycle,
Intake,
IssueUserProperty,
ProjectUserProperty,
Module,
Project,
DeployBoard,
Expand DownExpand Up@@ -217,7 +217,7 @@ def post(self, request, slug):
# Add the user as Administrator to the project
_ = ProjectMember.objects.create(project_id=serializer.instance.id, member=request.user, role=20)
# Also create the issue property for the user
_ =IssueUserProperty.objects.create(project_id=serializer.instance.id, user=request.user)
_ =ProjectUserProperty.objects.create(project_id=serializer.instance.id, user=request.user)

if serializer.instance.project_lead is not None and str(serializer.instance.project_lead) != str(
request.user.id
Expand All@@ -228,7 +228,7 @@ def post(self, request, slug):
role=20,
)
# Also create the issue property for the user
IssueUserProperty.objects.create(
ProjectUserProperty.objects.create(
project_id=serializer.instance.id,
user_id=serializer.instance.project_lead,
)
Expand Down
4 changes: 2 additions & 2 deletionsapps/api/plane/app/serializers/issue.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
Issue,
IssueActivity,
IssueComment,
IssueUserProperty,
ProjectUserProperty,
IssueAssignee,
IssueSubscriber,
IssueLabel,
Expand DownExpand Up@@ -348,7 +348,7 @@ class Meta:

class IssueUserPropertySerializer(BaseSerializer):
class Meta:
model =IssueUserProperty
model =ProjectUserProperty
fields = "__all__"
read_only_fields = ["user", "workspace", "project"]

Expand Down
4 changes: 2 additions & 2 deletionsapps/api/plane/app/urls/issue.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -208,13 +208,13 @@
name="project-issue-comment-reactions",
),
## End Comment Reactions
##IssueUserProperty
##ProjectUserProperty
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/user-properties/",
IssueUserDisplayPropertyEndpoint.as_view(),
name="project-issue-display-properties",
),
##IssueUserProperty End
##ProjectUserProperty End
## Issue Archives
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/archived-issues/",
Expand Down
6 changes: 3 additions & 3 deletionsapps/api/plane/app/views/issue/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,7 +51,7 @@
IssueReaction,
IssueRelation,
IssueSubscriber,
IssueUserProperty,
ProjectUserProperty,
ModuleIssue,
Project,
ProjectMember,
Expand DownExpand Up@@ -718,7 +718,7 @@ def destroy(self, request, slug, project_id, pk=None):
class IssueUserDisplayPropertyEndpoint(BaseAPIView):
@allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST])
def patch(self, request, slug, project_id):
issue_property =IssueUserProperty.objects.get(user=request.user, project_id=project_id)
issue_property =ProjectUserProperty.objects.get(user=request.user, project_id=project_id)

issue_property.rich_filters = request.data.get("rich_filters", issue_property.rich_filters)
issue_property.filters = request.data.get("filters", issue_property.filters)
Expand All@@ -730,7 +730,7 @@ def patch(self, request, slug, project_id):

@allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST])
def get(self, request, slug, project_id):
issue_property, _ =IssueUserProperty.objects.get_or_create(user=request.user, project_id=project_id)
issue_property, _ =ProjectUserProperty.objects.get_or_create(user=request.user, project_id=project_id)
serializer = IssueUserPropertySerializer(issue_property)
return Response(serializer.data, status=status.HTTP_200_OK)

Expand Down
7 changes: 4 additions & 3 deletionsapps/api/plane/app/views/project/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,14 +26,15 @@
from plane.bgtasks.webhook_task import model_activity, webhook_activity
from plane.db.models import (
DeployBoard,
ProjectUserProperty,
Intake,
IssueUserProperty,
Project,
ProjectIdentifier,
ProjectMember,
ProjectNetwork,
State,
DEFAULT_STATES,
UserFavorite,
Workspace,
WorkspaceMember,
)
Expand DownExpand Up@@ -255,7 +256,7 @@ def create(self, request, slug):
role=ROLE.ADMIN.value,
)
# Also create the issue property for the user
_ =IssueUserProperty.objects.create(project_id=serializer.data["id"], user=request.user)
_ =ProjectUserProperty.objects.create(project_id=serializer.data["id"], user=request.user)

if serializer.data["project_lead"] is not None and str(serializer.data["project_lead"]) != str(
request.user.id
Expand All@@ -266,7 +267,7 @@ def create(self, request, slug):
role=ROLE.ADMIN.value,
)
# Also create the issue property for the user
IssueUserProperty.objects.create(
ProjectUserProperty.objects.create(
project_id=serializer.data["id"],
user_id=serializer.data["project_lead"],
)
Expand Down
6 changes: 3 additions & 3 deletionsapps/api/plane/app/views/project/invite.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,7 @@
User,
WorkspaceMember,
Project,
IssueUserProperty,
ProjectUserProperty,
)
from plane.db.models.project import ProjectNetwork
from plane.utils.host import base_host
Expand DownExpand Up@@ -160,9 +160,9 @@ def create(self, request, slug):
ignore_conflicts=True,
)

IssueUserProperty.objects.bulk_create(
ProjectUserProperty.objects.bulk_create(
[
IssueUserProperty(
ProjectUserProperty(
project_id=project_id,
user=request.user,
workspace=workspace,
Expand Down
6 changes: 3 additions & 3 deletionsapps/api/plane/app/views/project/member.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@

from plane.app.permissions import WorkspaceUserPermission

from plane.db.models import Project, ProjectMember,IssueUserProperty, WorkspaceMember
from plane.db.models import Project, ProjectMember,ProjectUserProperty, WorkspaceMember
from plane.bgtasks.project_add_user_email_task import project_add_user_email
from plane.utils.host import base_host
from plane.app.permissions.base import allow_permission, ROLE
Expand DownExpand Up@@ -119,7 +119,7 @@ def create(self, request, slug, project_id):
)
# Create a new issue property
bulk_issue_props.append(
IssueUserProperty(
ProjectUserProperty(
user_id=member.get("member_id"),
project_id=project_id,
workspace_id=project.workspace_id,
Expand All@@ -129,7 +129,7 @@ def create(self, request, slug, project_id):
# Bulk create the project members and issue properties
project_members = ProjectMember.objects.bulk_create(bulk_project_members, batch_size=10, ignore_conflicts=True)

_ =IssueUserProperty.objects.bulk_create(bulk_issue_props, batch_size=10, ignore_conflicts=True)
_ =ProjectUserProperty.objects.bulk_create(bulk_issue_props, batch_size=10, ignore_conflicts=True)

project_members = ProjectMember.objects.filter(
project_id=project_id,
Expand Down
6 changes: 3 additions & 3 deletionsapps/api/plane/bgtasks/workspace_seed_task.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
WorkspaceMember,
Project,
ProjectMember,
IssueUserProperty,
ProjectUserProperty,
State,
Label,
Issue,
Expand DownExpand Up@@ -118,9 +118,9 @@ def create_project_and_member(workspace: Workspace) -> Dict[int, uuid.UUID]:
)

# Create issue user properties
IssueUserProperty.objects.bulk_create(
ProjectUserProperty.objects.bulk_create(
[
IssueUserProperty(
ProjectUserProperty(
project=project,
user_id=workspace_member["member_id"],
workspace_id=workspace.id,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,7 @@
WorkspaceMember,
ProjectMember,
Project,
IssueUserProperty,
ProjectUserProperty,
)


Expand DownExpand Up@@ -67,7 +67,7 @@ def handle(self, *args: Any, **options: Any):
ProjectMember.objects.create(project=project, member=user, role=role, sort_order=sort_order)

# Issue Property
IssueUserProperty.objects.get_or_create(user=user, project=project)
ProjectUserProperty.objects.get_or_create(user=user, project=project)

# Success message
self.stdout.write(self.style.SUCCESS(f"User {user_email} added to project {project_id}"))
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
# Generated by Django 4.2.25 on 2025-11-28 14:36

fromdjango.dbimportmigrations,models
importplane.db.models.project
importdjango.db.models.deletion
fromdjango.confimportsettings

classMigration(migrations.Migration):

dependencies= [
('db','0112_auto_20251124_0603'),
]

operations= [
migrations.AlterModelTable(
name='issueuserproperty',
table='project_user_properties',
),
migrations.RenameModel(
old_name='IssueUserProperty',
new_name='ProjectUserProperty',
),
migrations.AddField(
model_name='apitoken',
name='allowed_rate_limit',
field=models.CharField(default='60/min',max_length=255),
),
migrations.AddField(
model_name='projectuserproperty',
name='preferences',
field=models.JSONField(default=plane.db.models.project.get_default_preferences),
),
migrations.AddField(
model_name='projectuserproperty',
name='sort_order',
field=models.FloatField(default=65535),
),migrations.AlterModelOptions(
name='projectuserproperty',
options={'ordering': ('-created_at',),'verbose_name':'Project User Property','verbose_name_plural':'Project User Properties'},
),
migrations.RemoveConstraint(
model_name='projectuserproperty',
name='issue_user_property_unique_user_project_when_deleted_at_null',
),
migrations.AlterField(
model_name='projectuserproperty',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,related_name='project_property_user',to=settings.AUTH_USER_MODEL),
),
migrations.AddConstraint(
model_name='projectuserproperty',
constraint=models.UniqueConstraint(condition=models.Q(('deleted_at__isnull',True)),fields=('user','project'),name='project_user_property_unique_user_project_when_deleted_at_null'),
),
]
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
# Generated by Django 4.2.25 on 2025-12-01 13:33

fromdjango.dbimportmigrations

defmove_issue_user_properties_to_project_user_properties(apps,schema_editor):
ProjectMember=apps.get_model('db','ProjectMember')
ProjectUserProperty=apps.get_model('db','ProjectUserProperty')

# Get all project members
project_members=ProjectMember.objects.filter(deleted_at__isnull=True).values('member_id','project_id','preferences','sort_order')

# create a mapping with consistent ordering
pm_dict= {
(pm['member_id'],pm['project_id']):pm
forpminproject_members
}

# Get all project user properties
properties_to_update= []
forprojectuserpropertyinProjectUserProperty.objects.filter(deleted_at__isnull=True):
pm=pm_dict.get((projectuserproperty.user_id,projectuserproperty.project_id))
ifpm:
projectuserproperty.preferences=pm['preferences']
projectuserproperty.sort_order=pm['sort_order']
properties_to_update.append(projectuserproperty)

ProjectUserProperty.objects.bulk_update(properties_to_update, ['preferences','sort_order'],batch_size=2000)



classMigration(migrations.Migration):

dependencies= [
('db','0113_alter_issueuserproperty_table'),
]

operations= [
migrations.RunPython(move_issue_user_properties_to_project_user_properties,reverse_code=migrations.RunPython.noop),
]
2 changes: 1 addition & 1 deletionapps/api/plane/db/models/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,7 +34,6 @@
IssueLabel,
IssueLink,
IssueMention,
IssueUserProperty,
IssueReaction,
IssueRelation,
IssueSequence,
Expand All@@ -54,6 +53,7 @@
ProjectMemberInvite,
ProjectNetwork,
ProjectPublicMember,
ProjectUserProperty,
)
from .session import Session
from .social_connection import SocialLoginConnection
Expand Down
1 change: 1 addition & 0 deletionsapps/api/plane/db/models/api.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,6 +32,7 @@ class APIToken(BaseModel):
workspace = models.ForeignKey("db.Workspace", related_name="api_tokens", on_delete=models.CASCADE, null=True)
expired_at = models.DateTimeField(blank=True, null=True)
is_service = models.BooleanField(default=False)
allowed_rate_limit = models.CharField(max_length=255, default="60/min")

class Meta:
verbose_name = "API Token"
Expand Down
30 changes: 0 additions & 30 deletionsapps/api/plane/db/models/issue.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -536,36 +536,6 @@ def __str__(self):
return str(self.issue)


class IssueUserProperty(ProjectBaseModel):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name="issue_property_user",
)
filters = models.JSONField(default=get_default_filters)
display_filters = models.JSONField(default=get_default_display_filters)
display_properties = models.JSONField(default=get_default_display_properties)
rich_filters = models.JSONField(default=dict)

class Meta:
verbose_name = "Issue User Property"
verbose_name_plural = "Issue User Properties"
db_table = "issue_user_properties"
ordering = ("-created_at",)
unique_together = ["user", "project", "deleted_at"]
constraints = [
models.UniqueConstraint(
fields=["user", "project"],
condition=Q(deleted_at__isnull=True),
name="issue_user_property_unique_user_project_when_deleted_at_null",
)
]

def __str__(self):
"""Return properties status of the issue"""
return str(self.user)


class IssueLabel(ProjectBaseModel):
issue = models.ForeignKey("db.Issue", on_delete=models.CASCADE, related_name="label_issue")
label = models.ForeignKey("db.Label", on_delete=models.CASCADE, related_name="label_issue")
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp