Try to fix tests
This commit is contained in:
parent
626a165411
commit
f4c70096e2
4 changed files with 38 additions and 11 deletions
24
app/main.py
24
app/main.py
|
@ -443,6 +443,28 @@ def outbox_by_public_id(
|
|||
|
||||
replies_tree = boxes.get_replies_tree(db, maybe_object)
|
||||
|
||||
likes = (
|
||||
db.query(models.InboxObject)
|
||||
.filter(
|
||||
models.InboxObject.ap_type == "Like",
|
||||
models.InboxObject.activity_object_ap_id == maybe_object.ap_id,
|
||||
)
|
||||
.options(joinedload(models.InboxObject.actor))
|
||||
.order_by(models.InboxObject.ap_published_at.desc())
|
||||
.limit(10)
|
||||
)
|
||||
|
||||
shares = (
|
||||
db.query(models.InboxObject)
|
||||
.filter(
|
||||
models.InboxObject.ap_type == "Announce",
|
||||
models.InboxObject.activity_object_ap_id == maybe_object.ap_id,
|
||||
)
|
||||
.options(joinedload(models.InboxObject.actor))
|
||||
.order_by(models.InboxObject.ap_published_at.desc())
|
||||
.limit(10)
|
||||
)
|
||||
|
||||
return templates.render_template(
|
||||
db,
|
||||
request,
|
||||
|
@ -450,6 +472,8 @@ def outbox_by_public_id(
|
|||
{
|
||||
"replies_tree": replies_tree,
|
||||
"outbox_object": maybe_object,
|
||||
"likes": likes,
|
||||
"shares": shares,
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
@ -58,14 +58,14 @@ class InboxObject(Base, BaseObject):
|
|||
is_hidden_from_stream = Column(Boolean, nullable=False, default=False)
|
||||
|
||||
ap_actor_id = Column(String, nullable=False)
|
||||
ap_type = Column(String, nullable=False)
|
||||
ap_type = Column(String, nullable=False, index=True)
|
||||
ap_id = Column(String, nullable=False, unique=True, index=True)
|
||||
ap_context = Column(String, nullable=True)
|
||||
ap_published_at = Column(DateTime(timezone=True), nullable=False)
|
||||
ap_object: Mapped[ap.RawObject] = Column(JSON, nullable=False)
|
||||
|
||||
# Only set for activities
|
||||
activity_object_ap_id = Column(String, nullable=True)
|
||||
activity_object_ap_id = Column(String, nullable=True, index=True)
|
||||
|
||||
visibility = Column(Enum(ap.VisibilityEnum), nullable=False)
|
||||
|
||||
|
@ -134,12 +134,12 @@ class OutboxObject(Base, BaseObject):
|
|||
|
||||
public_id = Column(String, nullable=False, index=True)
|
||||
|
||||
ap_type = Column(String, nullable=False)
|
||||
ap_type = Column(String, nullable=False, index=True)
|
||||
ap_id = Column(String, nullable=False, unique=True, index=True)
|
||||
ap_context = Column(String, nullable=True)
|
||||
ap_object: Mapped[ap.RawObject] = Column(JSON, nullable=False)
|
||||
|
||||
activity_object_ap_id = Column(String, nullable=True)
|
||||
activity_object_ap_id = Column(String, nullable=True, index=True)
|
||||
|
||||
# Source content for activities (like Notes)
|
||||
source = Column(String, nullable=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue