diff options
author | Andrew Godwin | 2022-11-13 18:42:47 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-13 18:43:09 -0700 |
commit | ddb3436275d3f02183f515c38cd3193cd1dfe2f4 (patch) | |
tree | 8902d4f085ad6d8323f43af20ca497d291e4d28a /activities/views | |
parent | 68c156fd2758da5831bd83bfb1249dd014d78177 (diff) | |
download | takahe-ddb3436275d3f02183f515c38cd3193cd1dfe2f4.tar.gz takahe-ddb3436275d3f02183f515c38cd3193cd1dfe2f4.tar.bz2 takahe-ddb3436275d3f02183f515c38cd3193cd1dfe2f4.zip |
Boosting! Incoming, anyway.
Diffstat (limited to 'activities/views')
-rw-r--r-- | activities/views/timelines.py | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/activities/views/timelines.py b/activities/views/timelines.py index 76cf018..9be988d 100644 --- a/activities/views/timelines.py +++ b/activities/views/timelines.py @@ -33,15 +33,15 @@ class Home(FormView): def get_context_data(self): context = super().get_context_data() - context["timeline_posts"] = [ - te.subject_post - for te in TimelineEvent.objects.filter( + context["events"] = ( + TimelineEvent.objects.filter( identity=self.request.identity, - type=TimelineEvent.Types.post, + type__in=[TimelineEvent.Types.post, TimelineEvent.Types.boost], ) .select_related("subject_post", "subject_post__author") .order_by("-created")[:100] - ] + ) + context["current_page"] = "home" return context @@ -55,16 +55,50 @@ class Home(FormView): @method_decorator(identity_required, name="dispatch") +class Local(TemplateView): + + template_name = "activities/local.html" + + def get_context_data(self): + context = super().get_context_data() + context["posts"] = ( + Post.objects.filter(visibility=Post.Visibilities.public, author__local=True) + .select_related("author") + .order_by("-created")[:100] + ) + context["current_page"] = "local" + return context + + +@method_decorator(identity_required, name="dispatch") class Federated(TemplateView): template_name = "activities/federated.html" def get_context_data(self): context = super().get_context_data() - context["timeline_posts"] = ( + context["posts"] = ( Post.objects.filter(visibility=Post.Visibilities.public) .select_related("author") .order_by("-created")[:100] ) context["current_page"] = "federated" return context + + +@method_decorator(identity_required, name="dispatch") +class Notifications(TemplateView): + + template_name = "activities/notifications.html" + + def get_context_data(self): + context = super().get_context_data() + context["events"] = ( + TimelineEvent.objects.filter( + identity=self.request.identity, + ) + .exclude(type__in=[TimelineEvent.Types.post, TimelineEvent.Types.boost]) + .select_related("subject_post", "subject_post__author", "subject_identity") + ) + context["current_page"] = "notifications" + return context |