thread-id-fix
All checks were successful
deploy / deploy (push) Successful in 1m12s

This commit is contained in:
Untone 2023-12-22 13:08:35 +03:00
parent 999fafac71
commit 051d35869b
3 changed files with 10 additions and 2 deletions

View File

@ -66,6 +66,7 @@ async def get_notifications_grouped(
elif n.action == "create": elif n.action == "create":
print(f"[resolvers.schema] create shout: {shout}") print(f"[resolvers.schema] create shout: {shout}")
notification_group = NotificationGroup( notification_group = NotificationGroup(
id=thread_id,
entity=n.entity, entity=n.entity,
shout=shout, shout=shout,
authors=shout.authors, authors=shout.authors,
@ -105,6 +106,7 @@ async def get_notifications_grouped(
reactions = [] reactions = []
reactions.append(reaction.id) reactions.append(reaction.id)
notification_group = NotificationGroup( notification_group = NotificationGroup(
id=thread_id,
action=n.action, action=n.action,
entity=n.entity, entity=n.entity,
updated_at=reaction.created_at, updated_at=reaction.created_at,
@ -122,6 +124,7 @@ async def get_notifications_grouped(
notification_group = notifications.get(thread_id) notification_group = notifications.get(thread_id)
if not notification_group: if not notification_group:
notification_group = NotificationGroup( notification_group = NotificationGroup(
id=thread_id,
authors=[follower], authors=[follower],
updated_at=int(time.time()), updated_at=int(time.time()),
shout=None, shout=None,
@ -129,6 +132,9 @@ async def get_notifications_grouped(
entity="follower", entity="follower",
action="follow", action="follow",
) )
else:
notification_group.authors = [follower, ]
notification_group.updated_at = int(time.time())
# store group in result # store group in result
notifications[thread_id] = notification_group notifications[thread_id] = notification_group
counter += 1 counter += 1

View File

@ -52,6 +52,7 @@ class NotificationReaction:
@strawberry.type @strawberry.type
class NotificationGroup: class NotificationGroup:
id: str
authors: List[NotificationAuthor] authors: List[NotificationAuthor]
updated_at: int updated_at: int
entity: str entity: str

View File

@ -47,9 +47,10 @@ async def check_auth(req) -> str | None:
print(f"[services.auth] got user_id: {user_id}") print(f"[services.auth] got user_id: {user_id}")
return user_id return user_id
except Exception as e: except Exception as e:
import traceback
traceback.print_exc()
# Handling and logging exceptions during authentication check # Handling and logging exceptions during authentication check
print(f"[services.auth] {e}") print(f"[services.auth] Error {e}")
return None return None