Link to post pages and show replies there

Fixes #60, #59
pull/65/head
Andrew Godwin 2022-11-27 12:37:52 -07:00
rodzic 03ba96ff26
commit 3217569df5
4 zmienionych plików z 33 dodań i 2 usunięć

Wyświetl plik

@ -1,5 +1,6 @@
from django import forms from django import forms
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.db import models
from django.http import JsonResponse from django.http import JsonResponse
from django.shortcuts import get_object_or_404, redirect, render from django.shortcuts import get_object_or_404, redirect, render
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
@ -47,6 +48,26 @@ class Individual(TemplateView):
[self.post_obj], [self.post_obj],
self.request.identity, 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): def serve_object(self):

Wyświetl plik

@ -695,10 +695,16 @@ h1.identity small {
.post { .post {
margin-bottom: 20px; margin-bottom: 20px;
overflow: hidden; overflow: hidden;
cursor: pointer;
} }
.post.mini { .post.mini {
font-size: 14px; font-size: 14px;
cursor: inherit;
}
.post.reply {
margin-left: 32px;
} }
.left-column .post { .left-column .post {
@ -778,7 +784,8 @@ h1.identity small {
margin-left: 64px; margin-left: 64px;
} }
.post.mini .content, .post.mini .edited { .post.mini .content,
.post.mini .edited {
margin-left: 0px; margin-left: 0px;
} }

Wyświetl plik

@ -1,6 +1,6 @@
{% load static %} {% load static %}
{% load activity_tags %} {% load activity_tags %}
<div class="post" data-takahe-id="{{ post.id }}"> <div class="post {% if reply %}reply{% endif %}" data-takahe-id="{{ post.id }}" _="on click go url {{ post.urls.view }}">
<a href="{{ post.author.urls.view }}"> <a href="{{ post.author.urls.view }}">
<img src="{{ post.author.local_icon_url }}" class="icon"> <img src="{{ post.author.local_icon_url }}" class="icon">

Wyświetl plik

@ -4,4 +4,7 @@
{% block content %} {% block content %}
{% include "activities/_post.html" %} {% include "activities/_post.html" %}
{% for reply in replies %}
{% include "activities/_post.html" with post=reply reply=True %}
{% endfor %}
{% endblock %} {% endblock %}