diff --git a/catalog/templates/edition.html b/catalog/templates/edition.html
index f6ff2eaf..5e0b21ef 100644
--- a/catalog/templates/edition.html
+++ b/catalog/templates/edition.html
@@ -148,7 +148,7 @@
目录
+
+
diff --git a/journal/models/common.py b/journal/models/common.py
index 9a72d631..16c6bb3c 100644
--- a/journal/models/common.py
+++ b/journal/models/common.py
@@ -37,7 +37,7 @@ def q_owned_piece_visible_to_user(viewing_user: User, owner: APIdentity):
return Q(visibility=0)
viewer = viewing_user.identity
if viewer == owner:
- return Q()
+ return Q(owner=owner)
# elif viewer.is_blocked_by(owner):
# return Q(pk__in=[])
elif viewer.is_following(owner):
diff --git a/journal/views/common.py b/journal/views/common.py
index c305f94d..47b3dd3e 100644
--- a/journal/views/common.py
+++ b/journal/views/common.py
@@ -53,7 +53,7 @@ def render_list(
request: AuthedHttpRequest,
user_name,
type,
- shelf_type=None,
+ shelf_type: ShelfType | None = None,
item_category=None,
tag_title=None,
year=None,
@@ -61,10 +61,8 @@ def render_list(
target = request.target_identity
viewer = request.user.identity
tag = None
- if type == "mark":
- queryset = target.user.shelf_manager.get_latest_members(
- shelf_type, item_category
- )
+ if type == "mark" and shelf_type:
+ queryset = target.shelf_manager.get_latest_members(shelf_type, item_category)
elif type == "tagmember":
tag = Tag.objects.filter(owner=target, title=tag_title).first()
if not tag:
diff --git a/journal/views/profile.py b/journal/views/profile.py
index 046291e4..2a61113b 100644
--- a/journal/views/profile.py
+++ b/journal/views/profile.py
@@ -50,8 +50,10 @@ def profile(request: AuthedHttpRequest, user_name):
"count": members.count(),
"members": members[:10].prefetch_related("item"),
}
- reviews = Review.objects.filter(q_item_in_category(category)).order_by(
- "-created_time"
+ reviews = (
+ Review.objects.filter(q_item_in_category(category))
+ .filter(qv)
+ .order_by("-created_time")
)
shelf_list[category]["reviewed"] = {
"title": "评论过的" + category.label,
diff --git a/neodb-takahe b/neodb-takahe
index ea3a8d36..53d05334 160000
--- a/neodb-takahe
+++ b/neodb-takahe
@@ -1 +1 @@
-Subproject commit ea3a8d36644e4864aa5a55b1b207397eeebb9376
+Subproject commit 53d05334a23df974799ba8c19a388a28376d55b1
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 50a86089..836b8c33 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -6,4 +6,4 @@ djlint~=1.34.0
isort~=5.12.0
lxml-stubs
pre-commit
-pyright==1.1.336
+pyright==1.1.338
diff --git a/takahe/management/commands/backfill_takahe.py b/takahe/management/commands/backfill_takahe.py
index a2b93f45..fe204fa3 100644
--- a/takahe/management/commands/backfill_takahe.py
+++ b/takahe/management/commands/backfill_takahe.py
@@ -1,3 +1,5 @@
+from datetime import datetime, timezone
+
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
@@ -19,6 +21,8 @@
BATCH_SIZE = 1000
+TIMELINE_START = datetime.datetime(2023, 7, 1, tzinfo=timezone.utc)
+
def content_type_id(cls):
return ContentType.objects.get(app_label="journal", model=cls.__name__.lower()).pk
@@ -115,7 +119,7 @@ def add_event(post_id, author_id, owner_id, published):
published=post.published,
)
)
- if post.visibility != 3:
+ if post.visibility != 3 and post.published > TIMELINE_START:
for follower_id in followers[post.author_id]:
events.append(
TimelineEvent(
diff --git a/takahe/models.py b/takahe/models.py
index 9bb8d234..f947947b 100644
--- a/takahe/models.py
+++ b/takahe/models.py
@@ -690,6 +690,19 @@ def generate_keypair(self):
self.public_key_id = self.actor_uri + "#main-key"
self.save()
+ def ensure_uris(self):
+ """
+ Ensures that local identities have all the URIs populated on their fields
+ (this lets us add new ones easily)
+ """
+ if self.local:
+ self.inbox_uri = self.actor_uri + "inbox/"
+ self.outbox_uri = self.actor_uri + "outbox/"
+ self.featured_collection_uri = self.actor_uri + "collections/featured/"
+ self.followers_uri = self.actor_uri + "followers/"
+ self.following_uri = self.actor_uri + "following/"
+ self.shared_inbox_uri = f"https://{self.domain.uri_domain}/inbox/"
+
class Follow(models.Model):
"""
diff --git a/takahe/utils.py b/takahe/utils.py
index 1f462302..137d7734 100644
--- a/takahe/utils.py
+++ b/takahe/utils.py
@@ -99,6 +99,7 @@ def init_identity_for_local_user(u: "NeoUser"):
discoverable=not u.preference.no_anonymous_view,
)
identity.generate_keypair()
+ identity.ensure_uris()
if not user.identities.filter(pk=identity.pk).exists():
user.identities.add(identity)
apidentity = APIdentity.objects.filter(pk=identity.pk).first()
diff --git a/users/models/user.py b/users/models/user.py
index c543afd7..06f29665 100644
--- a/users/models/user.py
+++ b/users/models/user.py
@@ -414,6 +414,8 @@ def identity_linked(self):
return APIdentity.objects.filter(user=self).exists()
def initialize(self):
+ if not self.username:
+ raise ValueError("Username is not set")
Takahe.init_identity_for_local_user(self)
self.identity.shelf_manager