diff --git a/activities/services/timeline.py b/activities/services/timeline.py index a065b73..5e7015d 100644 --- a/activities/services/timeline.py +++ b/activities/services/timeline.py @@ -81,15 +81,31 @@ class TimelineService: .order_by("-created") ) - def identity_public(self, identity: Identity): + def identity_public(self, identity: Identity, include_boosts: bool = True): """ - Returns all publically visible posts for an identity + Returns timeline events with all of an identity's publicly visible posts + and their boosts """ + filter = models.Q( + type=TimelineEvent.Types.post, + subject_post__author=identity, + subject_post__visibility__in=[ + Post.Visibilities.public, + Post.Visibilities.local_only, + Post.Visibilities.unlisted, + ], + ) + if include_boosts: + filter = filter | models.Q( + type=TimelineEvent.Types.boost, subject_identity=identity + ) return ( - PostService.queryset() - .filter(author=identity) - .unlisted(include_replies=True) - .order_by("-id") + self.event_queryset() + .filter( + filter, + identity=identity, + ) + .order_by("-created") ) def likes(self) -> models.QuerySet[Post]: diff --git a/templates/identity/view.html b/templates/identity/view.html index 0c59723..16e31d0 100644 --- a/templates/identity/view.html +++ b/templates/identity/view.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load activity_tags %} {% block title %}{{ identity }}{% endblock %} @@ -90,8 +91,20 @@ {% block subcontent %}