forked from github/plane
fix: minor fixes
This commit is contained in:
parent
23e3aa3dd9
commit
99405874f8
@ -245,7 +245,7 @@ class PageViewSet(BaseViewSet):
|
|||||||
|
|
||||||
unarchive_archive_page_and_descendants(page_id, datetime.now())
|
unarchive_archive_page_and_descendants(page_id, datetime.now())
|
||||||
|
|
||||||
return Response(status=status.HTTP_400_BAD_REQUEST)
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
def unarchive(self, request, slug, project_id, page_id):
|
def unarchive(self, request, slug, project_id, page_id):
|
||||||
page = Page.objects.get(pk=page_id, workspace__slug=slug, project_id=project_id)
|
page = Page.objects.get(pk=page_id, workspace__slug=slug, project_id=project_id)
|
||||||
@ -256,8 +256,10 @@ class PageViewSet(BaseViewSet):
|
|||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# if parent page is archived then the page will be un archived breaking the hierarchy
|
||||||
|
if page.parent_id and page.parent.archived_at:
|
||||||
page.parent = None
|
page.parent = None
|
||||||
page.save()
|
page.save(update_fields=['parent'])
|
||||||
|
|
||||||
unarchive_archive_page_and_descendants(page_id, None)
|
unarchive_archive_page_and_descendants(page_id, None)
|
||||||
|
|
||||||
@ -270,7 +272,6 @@ class PageViewSet(BaseViewSet):
|
|||||||
workspace__slug=slug,
|
workspace__slug=slug,
|
||||||
)
|
)
|
||||||
.filter(archived_at__isnull=False)
|
.filter(archived_at__isnull=False)
|
||||||
.filter(parent_id__isnull=True)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
@ -399,7 +400,6 @@ class SubPagesEndpoint(BaseAPIView):
|
|||||||
workspace__slug=slug,
|
workspace__slug=slug,
|
||||||
entity_name__in=["forward_link", "back_link"],
|
entity_name__in=["forward_link", "back_link"],
|
||||||
)
|
)
|
||||||
.filter(archived_at__isnull=True)
|
|
||||||
.select_related("project")
|
.select_related("project")
|
||||||
.select_related("workspace")
|
.select_related("workspace")
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user