feat: sub issue toggle (#464)

This commit is contained in:
pablohashescobar 2023-03-22 01:33:56 +05:30 committed by GitHub
parent 9339138c0e
commit 025c8b3835
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,12 +175,20 @@ class IssueViewSet(BaseViewSet):
def list(self, request, slug, project_id):
try:
filters = issue_filters(request.query_params, "GET")
show_sub_issues = request.GET.get("show_sub_issues", "true")
issue_queryset = (
self.get_queryset()
.order_by(request.GET.get("order_by", "created_at"))
.filter(**filters)
)
issue_queryset = (
issue_queryset
if show_sub_issues == "true"
else issue_queryset.filter(parent__isnull=True)
)
issues = IssueSerializer(issue_queryset, many=True).data
## Grouping the results