chore: inbox issue ordering (#1367)

This commit is contained in:
pablohashescobar 2023-06-23 13:33:01 +05:30 committed by GitHub
parent 37303e6cb8
commit 0cb856b92f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,7 +111,6 @@ class InboxIssueViewSet(BaseViewSet):
def list(self, request, slug, project_id, inbox_id): def list(self, request, slug, project_id, inbox_id):
try: try:
order_by = request.GET.get("order_by", "created_at")
filters = issue_filters(request.query_params, "GET") filters = issue_filters(request.query_params, "GET")
issues = ( issues = (
Issue.objects.filter( Issue.objects.filter(
@ -120,10 +119,10 @@ class InboxIssueViewSet(BaseViewSet):
project_id=project_id, project_id=project_id,
) )
.filter(**filters) .filter(**filters)
.order_by(order_by)
.annotate(bridge_id=F("issue_inbox__id")) .annotate(bridge_id=F("issue_inbox__id"))
.select_related("workspace", "project", "state", "parent") .select_related("workspace", "project", "state", "parent")
.prefetch_related("assignees", "labels") .prefetch_related("assignees", "labels")
.order_by("issue_inbox__snoozed_till", "issue_inbox__status")
.annotate( .annotate(
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id")) sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
.order_by() .order_by()