Skip to content

Commit

Permalink
Merge branch 'develop' into fix/code-block-vs-code-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Palanikannan1437 committed Apr 16, 2024
2 parents 4b34de0 + 963d078 commit 282b735
Show file tree
Hide file tree
Showing 94 changed files with 2,854 additions and 910 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "CodeQL"
on:
workflow_dispatch:
push:
branches: ["develop", "preview", "master"]
branches: ["preview", "master"]
pull_request:
branches: ["develop", "preview", "master"]
schedule:
Expand Down
2 changes: 1 addition & 1 deletion apiserver/plane/api/urls/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
name="transfer-issues",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/cycles/<uuid:pk>/archive/",
"workspaces/<str:slug>/projects/<uuid:project_id>/cycles/<uuid:cycle_id>/archive/",
CycleArchiveUnarchiveAPIEndpoint.as_view(),
name="cycle-archive-unarchive",
),
Expand Down
17 changes: 10 additions & 7 deletions apiserver/plane/api/views/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ def get(self, request, slug, project_id, pk=None):
data,
status=status.HTTP_200_OK,
)
queryset = (
self.get_queryset().filter(archived_at__isnull=True)
)
queryset = self.get_queryset().filter(archived_at__isnull=True)
cycle_view = request.GET.get("cycle_view", "all")

# Current Cycle
Expand Down Expand Up @@ -495,17 +493,22 @@ def get(self, request, slug, project_id):
).data,
)

def post(self, request, slug, project_id, pk):
def post(self, request, slug, project_id, cycle_id):
cycle = Cycle.objects.get(
pk=pk, project_id=project_id, workspace__slug=slug
pk=cycle_id, project_id=project_id, workspace__slug=slug
)
if cycle.end_date >= timezone.now().date():
return Response(
{"error": "Only completed cycles can be archived"},
status=status.HTTP_400_BAD_REQUEST,
)
cycle.archived_at = timezone.now()
cycle.save()
return Response(status=status.HTTP_204_NO_CONTENT)

def delete(self, request, slug, project_id, pk):
def delete(self, request, slug, project_id, cycle_id):
cycle = Cycle.objects.get(
pk=pk, project_id=project_id, workspace__slug=slug
pk=cycle_id, project_id=project_id, workspace__slug=slug
)
cycle.archived_at = None
cycle.save()
Expand Down
9 changes: 8 additions & 1 deletion apiserver/plane/api/views/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def get_queryset(self):
.order_by(self.kwargs.get("order_by", "-created_at"))
)

def get(self, request, slug, project_id):
def get(self, request, slug, project_id, pk):
return self.paginate(
request=request,
queryset=(self.get_queryset()),
Expand All @@ -570,6 +570,13 @@ def post(self, request, slug, project_id, pk):
module = Module.objects.get(
pk=pk, project_id=project_id, workspace__slug=slug
)
if module.status not in ["completed", "cancelled"]:
return Response(
{
"error": "Only completed or cancelled modules can be archived"
},
status=status.HTTP_400_BAD_REQUEST,
)
module.archived_at = timezone.now()
module.save()
return Response(status=status.HTTP_204_NO_CONTENT)
Expand Down
5 changes: 5 additions & 0 deletions apiserver/plane/app/urls/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,9 @@
CycleArchiveUnarchiveEndpoint.as_view(),
name="cycle-archive-unarchive",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/archived-cycles/<uuid:pk>/",
CycleArchiveUnarchiveEndpoint.as_view(),
name="cycle-archive-unarchive",
),
]
5 changes: 5 additions & 0 deletions apiserver/plane/app/urls/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,9 @@
ModuleArchiveUnarchiveEndpoint.as_view(),
name="module-archive-unarchive",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/archived-modules/<uuid:pk>/",
ModuleArchiveUnarchiveEndpoint.as_view(),
name="module-archive-unarchive",
),
]
Loading

0 comments on commit 282b735

Please sign in to comment.