Various bugfixes
parent
9012356a19
commit
e6066cb212
27
app/boxes.py
27
app/boxes.py
|
@ -883,30 +883,41 @@ async def get_replies_tree(
|
|||
tree_nodes.extend(
|
||||
(
|
||||
await db_session.scalars(
|
||||
select(models.InboxObject).where(
|
||||
select(models.InboxObject)
|
||||
.where(
|
||||
models.InboxObject.ap_context == requested_object.ap_context,
|
||||
)
|
||||
.options(joinedload(models.InboxObject.actor))
|
||||
)
|
||||
).all()
|
||||
)
|
||||
.unique()
|
||||
.all()
|
||||
)
|
||||
tree_nodes.extend(
|
||||
(
|
||||
await db_session.scalars(
|
||||
select(models.OutboxObject).where(
|
||||
select(models.OutboxObject)
|
||||
.where(
|
||||
models.OutboxObject.ap_context == requested_object.ap_context,
|
||||
models.OutboxObject.is_deleted.is_(False),
|
||||
)
|
||||
.options(
|
||||
joinedload(models.OutboxObject.outbox_object_attachments).options(
|
||||
joinedload(models.OutboxObjectAttachment.upload)
|
||||
)
|
||||
).all()
|
||||
)
|
||||
)
|
||||
)
|
||||
.unique()
|
||||
.all()
|
||||
)
|
||||
nodes_by_in_reply_to = defaultdict(list)
|
||||
for node in tree_nodes:
|
||||
nodes_by_in_reply_to[node.in_reply_to].append(node)
|
||||
logger.info(nodes_by_in_reply_to)
|
||||
|
||||
# TODO: get oldest if we cannot get to root?
|
||||
if len(nodes_by_in_reply_to.get(None, [])) != 1:
|
||||
raise ValueError("Failed to compute replies tree")
|
||||
if len(nodes_by_in_reply_to.get(None, [])) > 1:
|
||||
raise ValueError("Invalid replies tree")
|
||||
|
||||
def _get_reply_node_children(
|
||||
node: ReplyTreeNode,
|
||||
|
@ -932,7 +943,7 @@ async def get_replies_tree(
|
|||
else:
|
||||
root_ap_object = sorted(
|
||||
tree_nodes,
|
||||
lambda ap_obj: ap_obj.ap_published_at, # type: ignore
|
||||
key=lambda ap_obj: ap_obj.ap_published_at, # type: ignore
|
||||
)[0]
|
||||
|
||||
root_node = ReplyTreeNode(
|
||||
|
|
|
@ -739,7 +739,7 @@ async def nodeinfo(
|
|||
)
|
||||
|
||||
|
||||
proxy_client = httpx.AsyncClient()
|
||||
proxy_client = httpx.AsyncClient(follow_redirects=True)
|
||||
|
||||
|
||||
@app.get("/proxy/media/{encoded_url}")
|
||||
|
@ -820,6 +820,7 @@ async def serve_proxy_media_resized(
|
|||
]
|
||||
]
|
||||
+ [(b"user-agent", USER_AGENT.encode())],
|
||||
follow_redirects=True,
|
||||
)
|
||||
if proxy_resp.status_code != 200:
|
||||
return PlainTextResponse(
|
||||
|
|
|
@ -83,9 +83,10 @@ def process_next_outgoing_activity(db: Session) -> bool:
|
|||
models.OutgoingActivity.is_sent.is_(False),
|
||||
]
|
||||
q_count = db.scalar(select(func.count(models.OutgoingActivity.id)).where(*where))
|
||||
if q_count > 0:
|
||||
logger.info(f"{q_count} outgoing activities ready to process")
|
||||
if not q_count:
|
||||
logger.info("No activities to process")
|
||||
# logger.debug("No activities to process")
|
||||
return False
|
||||
|
||||
next_activity = db.execute(
|
||||
|
|
|
@ -127,7 +127,7 @@ footer {
|
|||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -294,8 +294,6 @@
|
|||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{% endmacro %}
|
||||
|
||||
{% macro display_object(object) %}
|
||||
|
|
Loading…
Reference in New Issue