Show boosts and likes on other post list pages

pull/38/head
Andrew Godwin 2022-11-22 19:58:42 -07:00
rodzic 5616ef02b3
commit 975c205d1d
2 zmienionych plików z 19 dodań i 1 usunięć

Wyświetl plik

@ -77,6 +77,13 @@ class Local(ListView):
.order_by("-created")[:50]
)
def get_context_data(self):
context = super().get_context_data()
context["interactions"] = PostInteraction.get_post_interactions(
context["page_obj"], self.request.identity
)
return context
@method_decorator(identity_required, name="dispatch")
class Federated(ListView):
@ -96,6 +103,13 @@ class Federated(ListView):
.order_by("-created")[:50]
)
def get_context_data(self):
context = super().get_context_data()
context["interactions"] = PostInteraction.get_post_interactions(
context["page_obj"], self.request.identity
)
return context
@method_decorator(identity_required, name="dispatch")
class Notifications(ListView):

Wyświetl plik

@ -8,7 +8,7 @@ from django.shortcuts import redirect
from django.utils.decorators import method_decorator
from django.views.generic import FormView, ListView, TemplateView, View
from activities.models import Post
from activities.models import Post, PostInteraction
from core.ld import canonicalise
from core.models import Config
from users.decorators import identity_required
@ -72,6 +72,10 @@ class ViewIdentity(ListView):
context["identity"] = self.identity
context["follow"] = None
context["reverse_follow"] = None
context["interactions"] = PostInteraction.get_post_interactions(
context["page_obj"],
self.request.identity,
)
if self.request.identity:
follow = Follow.maybe_get(self.request.identity, self.identity)
if follow and follow.state in FollowStates.group_active():