From c0af8fb862784611e7874bf542fa2cbfbcb2a66e Mon Sep 17 00:00:00 2001
From: Your Name
Date: Fri, 7 Jul 2023 18:33:34 -0400
Subject: [PATCH] manage and export followers
---
common/templates/_sidebar.html | 2 +-
journal/models.py | 13 +++++++++----
users/templates/users/account.html | 6 ++++++
users/templates/users/profile_actions.html | 9 +++++++++
users/templates/users/relationship_list.html | 4 ++--
5 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/common/templates/_sidebar.html b/common/templates/_sidebar.html
index 34fcd4f3..54fb321e 100644
--- a/common/templates/_sidebar.html
+++ b/common/templates/_sidebar.html
@@ -58,7 +58,7 @@
-
+
{% if user == request.user %}
{% if user.locked %}
diff --git a/journal/models.py b/journal/models.py
index 2c6dba87..285eb4b8 100644
--- a/journal/models.py
+++ b/journal/models.py
@@ -58,10 +58,15 @@ def max_visiblity_to(viewer, owner):
def query_visible(user):
return (
- Q(visibility=0)
- | Q(owner_id__in=user.following if user.is_authenticated else [], visibility=1)
- | Q(owner_id=user.id)
- ) & ~Q(owner_id__in=user.ignoring)
+ (
+ Q(visibility=0)
+ | Q(owner_id__in=user.following, visibility=1)
+ | Q(owner_id=user.id)
+ )
+ & ~Q(owner_id__in=user.ignoring)
+ if user.is_authenticated
+ else Q(visibility=0)
+ )
def query_following(user):
diff --git a/users/templates/users/account.html b/users/templates/users/account.html
index f3fb16ff..828cbc14 100644
--- a/users/templates/users/account.html
+++ b/users/templates/users/account.html
@@ -92,6 +92,12 @@
{% include 'users/relationship_list.html' with name="关注" id="follow" list=request.user.local_following.all %}
+
+
+ {% trans '关注了你的用户' %}
+ {% include 'users/relationship_list.html' with name="关注者" id="follower" list=request.user.local_followers.all %}
+
+
{% trans '已隐藏的用户' %}
diff --git a/users/templates/users/profile_actions.html b/users/templates/users/profile_actions.html
index bb266dbf..206a71d7 100644
--- a/users/templates/users/profile_actions.html
+++ b/users/templates/users/profile_actions.html
@@ -13,6 +13,15 @@
{{ relationship.status }}
+ {% else %}
+
+ {% endif %}
+ {% if show_home %}
+
+
+
+
+
{% endif %}
{% if relationship.following %}
{% if relationship.unfollowable %}
diff --git a/users/templates/users/relationship_list.html b/users/templates/users/relationship_list.html
index ddd13be7..5d567257 100644
--- a/users/templates/users/relationship_list.html
+++ b/users/templates/users/relationship_list.html
@@ -1,6 +1,6 @@
{% for user in list %}
- {% include 'users/profile_actions.html' %}
+ {% include 'users/profile_actions.html' with show_home=1 %}
- 此处只列出你在{{ site_name }}{{ name }}的用户,联邦宇宙{{ name }}列表可在你所属实例查询管理。
+ 此处只列出你在{{ site_name }}{{ name }},联邦宇宙{{ name }}列表可在你所属实例查询管理。