summaryrefslogtreecommitdiffstats
path: root/activities/views
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-27 12:37:52 -0700
committerAndrew Godwin2022-11-27 12:37:52 -0700
commit3217569df583829d776bcbaf77b80696d3527005 (patch)
tree8924b33d8dc2e768c1b594d99c9128b698499449 /activities/views
parent03ba96ff26943f11b0ae1a21a0bcc39309b05901 (diff)
downloadtakahe-3217569df583829d776bcbaf77b80696d3527005.tar.gz
takahe-3217569df583829d776bcbaf77b80696d3527005.tar.bz2
takahe-3217569df583829d776bcbaf77b80696d3527005.zip
Link to post pages and show replies there
Fixes #60, #59
Diffstat (limited to 'activities/views')
-rw-r--r--activities/views/posts.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/activities/views/posts.py b/activities/views/posts.py
index 083df30..8fbe361 100644
--- a/activities/views/posts.py
+++ b/activities/views/posts.py
@@ -1,5 +1,6 @@
from django import forms
from django.core.exceptions import PermissionDenied
+from django.db import models
from django.http import JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.decorators import method_decorator
@@ -47,6 +48,26 @@ class Individual(TemplateView):
[self.post_obj],
self.request.identity,
),
+ "replies": Post.objects.filter(
+ models.Q(
+ visibility__in=[
+ Post.Visibilities.public,
+ Post.Visibilities.local_only,
+ Post.Visibilities.unlisted,
+ ]
+ )
+ | models.Q(
+ visibility=Post.Visibilities.followers,
+ author__inbound_follows__source=self.identity,
+ )
+ | models.Q(
+ visibility=Post.Visibilities.mentioned,
+ mentions=self.identity,
+ ),
+ in_reply_to=self.post_obj.object_uri,
+ )
+ .distinct()
+ .order_by("published", "created"),
}
def serve_object(self):