forked from github/plane
fix: optimised code
This commit is contained in:
parent
2b764163bf
commit
2a3872077c
@ -235,10 +235,7 @@ class IssueViewSet(BaseViewSet):
|
|||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(issues, status=status.HTTP_200_OK)
|
||||||
issues, status=status.HTTP_200_OK
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def create(self, request, slug, project_id):
|
def create(self, request, slug, project_id):
|
||||||
project = Project.objects.get(pk=project_id)
|
project = Project.objects.get(pk=project_id)
|
||||||
@ -443,9 +440,7 @@ class UserWorkSpaceIssues(BaseAPIView):
|
|||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(issues, status=status.HTTP_200_OK)
|
||||||
issues, status=status.HTTP_200_OK
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class WorkSpaceIssuesEndpoint(BaseAPIView):
|
class WorkSpaceIssuesEndpoint(BaseAPIView):
|
||||||
@ -623,7 +618,6 @@ class IssueUserDisplayPropertyEndpoint(BaseAPIView):
|
|||||||
serializer = IssuePropertySerializer(issue_property)
|
serializer = IssuePropertySerializer(issue_property)
|
||||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||||
|
|
||||||
|
|
||||||
def get(self, request, slug, project_id):
|
def get(self, request, slug, project_id):
|
||||||
issue_property, _ = IssueProperty.objects.get_or_create(
|
issue_property, _ = IssueProperty.objects.get_or_create(
|
||||||
user=request.user, project_id=project_id
|
user=request.user, project_id=project_id
|
||||||
@ -1100,7 +1094,9 @@ class IssueArchiveViewSet(BaseViewSet):
|
|||||||
actor_id=str(request.user.id),
|
actor_id=str(request.user.id),
|
||||||
issue_id=str(issue.id),
|
issue_id=str(issue.id),
|
||||||
project_id=str(project_id),
|
project_id=str(project_id),
|
||||||
current_instance=json.dumps(IssueSerializer(issue).data, cls=DjangoJSONEncoder),
|
current_instance=json.dumps(
|
||||||
|
IssueSerializer(issue).data, cls=DjangoJSONEncoder
|
||||||
|
),
|
||||||
epoch=int(timezone.now().timestamp()),
|
epoch=int(timezone.now().timestamp()),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2160,9 +2156,7 @@ class IssueDraftViewSet(BaseViewSet):
|
|||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(issues, status=status.HTTP_200_OK)
|
||||||
issues, status=status.HTTP_200_OK
|
|
||||||
)
|
|
||||||
|
|
||||||
def create(self, request, slug, project_id):
|
def create(self, request, slug, project_id):
|
||||||
project = Project.objects.get(pk=project_id)
|
project = Project.objects.get(pk=project_id)
|
||||||
|
@ -425,7 +425,7 @@ def track_archive_at(
|
|||||||
issue_id=issue_id,
|
issue_id=issue_id,
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
workspace_id=workspace_id,
|
workspace_id=workspace_id,
|
||||||
comment=f"has restored the issue",
|
comment="has restored the issue",
|
||||||
verb="updated",
|
verb="updated",
|
||||||
actor_id=actor_id,
|
actor_id=actor_id,
|
||||||
field="archived_at",
|
field="archived_at",
|
||||||
@ -440,7 +440,7 @@ def track_archive_at(
|
|||||||
issue_id=issue_id,
|
issue_id=issue_id,
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
workspace_id=workspace_id,
|
workspace_id=workspace_id,
|
||||||
comment=f"Plane has archived the issue",
|
comment="Plane has archived the issue",
|
||||||
verb="updated",
|
verb="updated",
|
||||||
actor_id=actor_id,
|
actor_id=actor_id,
|
||||||
field="archived_at",
|
field="archived_at",
|
||||||
|
@ -71,7 +71,7 @@ def archive_old_issues():
|
|||||||
Issue.objects.bulk_update(
|
Issue.objects.bulk_update(
|
||||||
issues_to_update, ["archived_at"], batch_size=100
|
issues_to_update, ["archived_at"], batch_size=100
|
||||||
)
|
)
|
||||||
[
|
_ = [
|
||||||
issue_activity.delay(
|
issue_activity.delay(
|
||||||
type="issue.activity.updated",
|
type="issue.activity.updated",
|
||||||
requested_data=json.dumps({"archived_at": str(archive_at)}),
|
requested_data=json.dumps({"archived_at": str(archive_at)}),
|
||||||
|
Loading…
Reference in New Issue
Block a user