1
1
Fork 0
mirror of https://github.com/jointakahe/takahe.git synced 2025-04-22 13:24:06 +00:00

Re-use page for interaction query ()

Original code caused the query on timeline to issue twice. Once to satisfy the interactions lookup (which had no LIMIT) and then again for the page (which had a LIMIT 25).

Presumably we want interactions for the paginated events, especially since the un-LIMITed query would become extremely inefficient.
This commit is contained in:
Corry Haines 2023-01-04 15:42:57 -08:00 committed by GitHub
parent 69b0430819
commit 9ae9e03b9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,14 +25,15 @@ class Home(TemplateView):
events = TimelineService(self.request.identity).home()
paginator = Paginator(events, 25)
page_number = self.request.GET.get("page")
event_page = paginator.get_page(page_number)
context = {
"interactions": PostInteraction.get_event_interactions(
events,
event_page,
self.request.identity,
),
"current_page": "home",
"allows_refresh": True,
"page_obj": paginator.get_page(page_number),
"page_obj": event_page,
"form": self.form_class(request=self.request),
}
return context