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

Commit280c3ce

Browse files
fix: enhance ProjectUserDisplayPropertyEndpoint to handle missing properties by creating new entries and improve response handling
1 parentd874227 commit280c3ce

File tree

1 file changed

+18
-8
lines changed
  • apps/api/plane/app/views/issue

1 file changed

+18
-8
lines changed

‎apps/api/plane/app/views/issue/base.py‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -718,15 +718,25 @@ def destroy(self, request, slug, project_id, pk=None):
718718
classProjectUserDisplayPropertyEndpoint(BaseAPIView):
719719
@allow_permission([ROLE.ADMIN,ROLE.MEMBER,ROLE.GUEST])
720720
defpatch(self,request,slug,project_id):
721-
issue_property=ProjectUserProperty.objects.get(user=request.user,project_id=project_id)
721+
try:
722+
issue_property=ProjectUserProperty.objects.get(
723+
user=request.user,
724+
project_id=project_id
725+
)
726+
exceptProjectUserProperty.DoesNotExist:
727+
issue_property=ProjectUserProperty.objects.create(
728+
user=request.user,
729+
project_id=project_id
730+
)
722731

723-
issue_property.rich_filters=request.data.get("rich_filters",issue_property.rich_filters)
724-
issue_property.filters=request.data.get("filters",issue_property.filters)
725-
issue_property.display_filters=request.data.get("display_filters",issue_property.display_filters)
726-
issue_property.display_properties=request.data.get("display_properties",issue_property.display_properties)
727-
issue_property.save()
728-
serializer=ProjectUserPropertySerializer(issue_property)
729-
returnResponse(serializer.data,status=status.HTTP_201_CREATED)
732+
serializer=ProjectUserPropertySerializer(
733+
issue_property,
734+
data=request.data,
735+
partial=True
736+
)
737+
serializer.is_valid(raise_exception=True)
738+
serializer.save()
739+
returnResponse(serializer.data,status=status.HTTP_200_OK)
730740

731741
@allow_permission([ROLE.ADMIN,ROLE.MEMBER,ROLE.GUEST])
732742
defget(self,request,slug,project_id):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp