diff --git a/activities/views/timelines.py b/activities/views/timelines.py index 3afd908..e45ae99 100644 --- a/activities/views/timelines.py +++ b/activities/views/timelines.py @@ -27,8 +27,18 @@ class Home(TemplateView): identity=self.request.identity, type__in=[TimelineEvent.Types.post, TimelineEvent.Types.boost], ) - .select_related("subject_post", "subject_post__author") - .prefetch_related("subject_post__attachments", "subject_post__mentions") + .select_related( + "subject_post", + "subject_post__author", + "subject_post__author__domain", + "subject_identity", + "subject_identity__domain", + ) + .prefetch_related( + "subject_post__attachments", + "subject_post__mentions", + "subject_post__emojis", + ) .order_by("-published") ) paginator = Paginator(events, 50) @@ -71,7 +81,7 @@ class Tag(ListView): Post.objects.public() .filter(author__restriction=Identity.Restriction.none) .tagged_with(self.hashtag) - .select_related("author") + .select_related("author", "author__domain") .prefetch_related("attachments", "mentions") .order_by("-published") ) @@ -182,8 +192,13 @@ class Notifications(ListView): "subject_post__author", "subject_post__author__domain", "subject_identity", + "subject_identity__domain", + ) + .prefetch_related( + "subject_post__emojis", + "subject_post__mentions", + "subject_post__attachments", ) - .prefetch_related("subject_post__emojis") ) def get_context_data(self, **kwargs): diff --git a/api/views/timelines.py b/api/views/timelines.py index ae99fac..1e3a683 100644 --- a/api/views/timelines.py +++ b/api/views/timelines.py @@ -21,8 +21,15 @@ def home( identity=request.identity, type__in=[TimelineEvent.Types.post], ) - .select_related("subject_post", "subject_post__author") - .prefetch_related("subject_post__attachments") + .select_related( + "subject_post", + "subject_post__author", + "subject_post__author__domain", + ) + .prefetch_related( + "subject_post__attachments", + "subject_post__mentions", + ) .order_by("-published") ) events = paginator.paginate(