feat: add unread updates to My Work (#133)
This commit is contained in:
1 parent
d75a55f3f7
commit
f34fc8b5f5
7 files changed
+336
-13
No files matched your search
+6
-1
@@ -14,6 +14,7 @@ from src.gitea_proxy import (
|
||||
current_user,
|
||||
is_requested_review,
|
||||
issues,
|
||||
notifications,
|
||||
pull_requests,
|
||||
pull_review_detail,
|
||||
repos,
|
||||
@@ -224,19 +225,23 @@ async def _build_live_snapshot() -> dict:
|
||||
user_data = await current_user()
|
||||
if not isinstance(user_data, dict) or not user_data.get("login"):
|
||||
raise ContextPayloadError("Gitea current-user response was invalid")
|
||||
context_result, events_result = await asyncio.gather(
|
||||
context_result, events_result, notifications_result = await asyncio.gather(
|
||||
_load_context_for_user(user_data),
|
||||
activity_events(user_data),
|
||||
notifications(),
|
||||
return_exceptions=True,
|
||||
)
|
||||
context_ok = not isinstance(context_result, BaseException)
|
||||
events_ok = not isinstance(events_result, BaseException)
|
||||
notifications_ok = not isinstance(notifications_result, BaseException)
|
||||
return {
|
||||
"context": context_result if context_ok else None,
|
||||
"events": events_result if events_ok else None,
|
||||
"notifications": notifications_result if notifications_ok else None,
|
||||
"sections": {
|
||||
"context": "fresh" if context_ok else "temporarily unavailable",
|
||||
"events": "fresh" if events_ok else "temporarily unavailable",
|
||||
"notifications": "fresh" if notifications_ok else "temporarily unavailable",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user