diff --git a/src/researchhub_document/views/researchhub_unified_document_views.py b/src/researchhub_document/views/researchhub_unified_document_views.py index 4323dad63..c9f8a1726 100644 --- a/src/researchhub_document/views/researchhub_unified_document_views.py +++ b/src/researchhub_document/views/researchhub_unified_document_views.py @@ -679,11 +679,11 @@ def test_get_unified_documents(self, request): def get_unified_documents(self, request): is_anonymous = request.user.is_anonymous query_params = request.query_params - subscribed_hubs = query_params.get("subscribed_hubs", "false") + subscribed_hubs = query_params.get("subscribed_hubs", "false").lower() == "true" filtering = query_params.get("ordering", HOT) time_scope = query_params.get("time", "today") - if subscribed_hubs == "true" and not is_anonymous: + if subscribed_hubs and not is_anonymous: return self._get_subscribed_unified_documents(request) document_request_type = query_params.get("type", "all") @@ -708,7 +708,7 @@ def get_unified_documents(self, request): date_ranges=[time_scope], ) - documents = self.get_filtered_queryset() + documents = self.get_filtered_queryset().prefetch_related("fundraises") context = self._get_serializer_context() context["hub_id"] = hub_id page = self.paginate_queryset(documents)