forked from github/plane
chore: bug fix
This commit is contained in:
parent
15927c9cae
commit
9217630580
@ -63,6 +63,7 @@ class IssueSerializer(BaseSerializer):
|
|||||||
print(data.get("assignees"))
|
print(data.get("assignees"))
|
||||||
data["assignees"] = ProjectMember.objects.filter(
|
data["assignees"] = ProjectMember.objects.filter(
|
||||||
project_id=self.context.get("project_id"),
|
project_id=self.context.get("project_id"),
|
||||||
|
is_active=True,
|
||||||
member_id__in=data["assignees"],
|
member_id__in=data["assignees"],
|
||||||
).values_list("member_id", flat=True)
|
).values_list("member_id", flat=True)
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ class IssueSerializer(BaseSerializer):
|
|||||||
if (
|
if (
|
||||||
data.get("parent")
|
data.get("parent")
|
||||||
and not Issue.objects.filter(
|
and not Issue.objects.filter(
|
||||||
workspce_id=self.context.get("workspace_id"), pk=data.get("parent")
|
workspace_id=self.context.get("workspace_id"), pk=data.get("parent")
|
||||||
).exists()
|
).exists()
|
||||||
):
|
):
|
||||||
raise serializers.ValidationError(
|
raise serializers.ValidationError(
|
||||||
|
@ -15,7 +15,7 @@ urlpatterns = [
|
|||||||
name="issue",
|
name="issue",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/",
|
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:pk>/",
|
||||||
IssueAPIEndpoint.as_view(),
|
IssueAPIEndpoint.as_view(),
|
||||||
name="issue",
|
name="issue",
|
||||||
),
|
),
|
||||||
|
@ -9,7 +9,7 @@ urlpatterns = [
|
|||||||
name="project",
|
name="project",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/projects/<uuid:pk>/",
|
"workspaces/<str:slug>/projects/<uuid:project_id>/",
|
||||||
ProjectAPIEndpoint.as_view(),
|
ProjectAPIEndpoint.as_view(),
|
||||||
name="project",
|
name="project",
|
||||||
),
|
),
|
||||||
|
@ -250,7 +250,6 @@ class IssueAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
current_instance = json.dumps(
|
current_instance = json.dumps(
|
||||||
IssueSerializer(issue).data, cls=DjangoJSONEncoder
|
IssueSerializer(issue).data, cls=DjangoJSONEncoder
|
||||||
)
|
)
|
||||||
issue.delete()
|
|
||||||
issue_activity.delay(
|
issue_activity.delay(
|
||||||
type="issue.activity.deleted",
|
type="issue.activity.deleted",
|
||||||
requested_data=json.dumps({"issue_id": str(pk)}),
|
requested_data=json.dumps({"issue_id": str(pk)}),
|
||||||
@ -260,6 +259,7 @@ class IssueAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
current_instance=current_instance,
|
current_instance=current_instance,
|
||||||
epoch=int(timezone.now().timestamp()),
|
epoch=int(timezone.now().timestamp()),
|
||||||
)
|
)
|
||||||
|
issue.delete()
|
||||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,8 +94,8 @@ class ProjectAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
.distinct()
|
.distinct()
|
||||||
)
|
)
|
||||||
|
|
||||||
def get(self, request, slug, pk=None):
|
def get(self, request, slug, project_id=None):
|
||||||
if pk is None:
|
if project_id is None:
|
||||||
sort_order_query = ProjectMember.objects.filter(
|
sort_order_query = ProjectMember.objects.filter(
|
||||||
member=request.user,
|
member=request.user,
|
||||||
project_id=OuterRef("pk"),
|
project_id=OuterRef("pk"),
|
||||||
@ -124,7 +124,7 @@ class ProjectAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
).data,
|
).data,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
project = self.get_queryset().get(workspace__slug=slug, pk=pk)
|
project = self.get_queryset().get(workspace__slug=slug, pk=project_id)
|
||||||
serializer = ProjectSerializer(project, fields=self.fields, expand=self.expand,)
|
serializer = ProjectSerializer(project, fields=self.fields, expand=self.expand,)
|
||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
@ -236,10 +236,10 @@ class ProjectAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
status=status.HTTP_410_GONE,
|
status=status.HTTP_410_GONE,
|
||||||
)
|
)
|
||||||
|
|
||||||
def patch(self, request, slug, pk=None):
|
def patch(self, request, slug, project_id=None):
|
||||||
try:
|
try:
|
||||||
workspace = Workspace.objects.get(slug=slug)
|
workspace = Workspace.objects.get(slug=slug)
|
||||||
project = Project.objects.get(pk=pk)
|
project = Project.objects.get(pk=project_id)
|
||||||
|
|
||||||
serializer = ProjectSerializer(
|
serializer = ProjectSerializer(
|
||||||
project,
|
project,
|
||||||
@ -260,7 +260,7 @@ class ProjectAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
name="Triage",
|
name="Triage",
|
||||||
group="backlog",
|
group="backlog",
|
||||||
description="Default state for managing all Inbox Issues",
|
description="Default state for managing all Inbox Issues",
|
||||||
project_id=pk,
|
project_id=project_id,
|
||||||
color="#ff7700",
|
color="#ff7700",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ urlpatterns = [
|
|||||||
name="user-project-invitations",
|
name="user-project-invitations",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/projects/join/",
|
"workspaces/<str:slug>/projects/<uuid:project_id>/join/<uuid:pk>/",
|
||||||
ProjectJoinEndpoint.as_view(),
|
ProjectJoinEndpoint.as_view(),
|
||||||
name="project-join",
|
name="project-join",
|
||||||
),
|
),
|
||||||
|
@ -298,7 +298,6 @@ class IssueViewSet(WebhookMixin, BaseViewSet):
|
|||||||
current_instance = json.dumps(
|
current_instance = json.dumps(
|
||||||
IssueSerializer(issue).data, cls=DjangoJSONEncoder
|
IssueSerializer(issue).data, cls=DjangoJSONEncoder
|
||||||
)
|
)
|
||||||
issue.delete()
|
|
||||||
issue_activity.delay(
|
issue_activity.delay(
|
||||||
type="issue.activity.deleted",
|
type="issue.activity.deleted",
|
||||||
requested_data=json.dumps({"issue_id": str(pk)}),
|
requested_data=json.dumps({"issue_id": str(pk)}),
|
||||||
@ -308,6 +307,7 @@ class IssueViewSet(WebhookMixin, BaseViewSet):
|
|||||||
current_instance=current_instance,
|
current_instance=current_instance,
|
||||||
epoch=int(timezone.now().timestamp()),
|
epoch=int(timezone.now().timestamp()),
|
||||||
)
|
)
|
||||||
|
issue.delete()
|
||||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user