feat: load update conversations progressively (Closes #761)
CI / lint (pull_request) Successful in 1m38s
CI / build-release (pull_request) Successful in 5s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy committed 2026-08-13 18:25:21 +00:00
1 parent 7c86f28346
commit a9d586e689
8 files changed
+123 -33

No files matched your search

+4 -8
View File
@@ -948,19 +948,15 @@ async def notification_detail(thread_id: int) -> dict:
)
if supported_conversation:
assert conversation_match is not None
subject_detail, comment, conversation, subscription = await asyncio.gather(
subject_detail, comment, subscription = await asyncio.gather(
fetch(subject_path),
fetch(comment_path) if comment_path else asyncio.sleep(0, result={}),
issue_conversation_page(
conversation_match.group(1), int(conversation_match.group(3))
),
_notification_subscription(conversation_match.group(1), conversation_match.group(3)),
)
else:
subject_detail, comment, conversation, subscription = await asyncio.gather(
subject_detail, comment, subscription = await asyncio.gather(
fetch(subject_path) if subject_path else asyncio.sleep(0, result={}),
fetch(comment_path) if comment_path else asyncio.sleep(0, result={}),
asyncio.sleep(0, result={"comments": [], "page": 1, "older_page": None, "total": 0}),
asyncio.sleep(0, result={}),
)
subject_detail = subject_detail if isinstance(subject_detail, dict) else {}
@@ -1028,12 +1024,12 @@ async def notification_detail(thread_id: int) -> dict:
and subscription.get("subscribed") is True
and subscription.get("ignored") is not True
),
"conversation": conversation,
"conversation_available": bool(supported_conversation),
}
async def notification_conversation_page(
thread_id: int, page: int, limit: int = 20
thread_id: int, page: int | None, limit: int = 20
) -> dict:
thread = await fetch(f"notifications/threads/{thread_id}")
if not isinstance(thread, dict):
+1 -1
View File
@@ -3634,7 +3634,7 @@ async def notification_thread_detail(
@app.get("/api/v1/notifications/{thread_id}/conversation")
async def notification_thread_conversation(
thread_id: int = PathParam(gt=0),
page: int = Query(ge=1),
page: int | None = Query(default=None, ge=1),
limit: int = Query(default=20, ge=1, le=50),
) -> JSONResponse:
try: