feat(notifications): honor chat mute in web realtime alerts
Some checks failed
CI / test (push) Failing after 1m30s
Some checks failed
CI / test (push) Failing after 1m30s
This commit is contained in:
@@ -21,6 +21,7 @@ class ChatRead(BaseModel):
|
||||
is_saved: bool = False
|
||||
archived: bool = False
|
||||
pinned: bool = False
|
||||
muted: bool = False
|
||||
unread_count: int = 0
|
||||
unread_mentions_count: int = 0
|
||||
pinned_message_id: int | None = None
|
||||
|
||||
@@ -120,8 +120,10 @@ async def serialize_chat_for_user(
|
||||
)
|
||||
last_message = await repository.get_last_visible_message_for_user(db, chat_id=chat.id, user_id=user_id)
|
||||
user_setting = await repository.get_chat_user_setting(db, chat_id=chat.id, user_id=user_id)
|
||||
notification_setting = await repository.get_chat_notification_setting(db, chat_id=chat.id, user_id=user_id)
|
||||
archived = bool(user_setting and user_setting.archived)
|
||||
pinned = bool(user_setting and user_setting.pinned)
|
||||
muted = bool(notification_setting and notification_setting.muted)
|
||||
|
||||
return ChatRead.model_validate(
|
||||
{
|
||||
@@ -137,6 +139,7 @@ async def serialize_chat_for_user(
|
||||
"is_saved": chat.is_saved,
|
||||
"archived": archived,
|
||||
"pinned": pinned,
|
||||
"muted": muted,
|
||||
"unread_count": unread_count,
|
||||
"unread_mentions_count": unread_mentions_count,
|
||||
"pinned_message_id": chat.pinned_message_id,
|
||||
|
||||
Reference in New Issue
Block a user