fix(sync): publish chat updates for mute archive and pin mutations
Some checks are pending
CI / test (push) Has started running
Some checks are pending
CI / test (push) Has started running
This commit is contained in:
@@ -314,12 +314,14 @@ async def update_chat_notifications(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> ChatNotificationSettingsRead:
|
||||
return await update_chat_notification_settings_for_user(
|
||||
settings = await update_chat_notification_settings_for_user(
|
||||
db,
|
||||
chat_id=chat_id,
|
||||
user_id=current_user.id,
|
||||
payload=payload,
|
||||
)
|
||||
await realtime_gateway.publish_chat_updated(chat_id=chat_id)
|
||||
return settings
|
||||
|
||||
|
||||
@router.post("/{chat_id}/archive", response_model=ChatRead)
|
||||
@@ -329,6 +331,7 @@ async def archive_chat(
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> ChatRead:
|
||||
chat = await set_chat_archived_for_user(db, chat_id=chat_id, user_id=current_user.id, archived=True)
|
||||
await realtime_gateway.publish_chat_updated(chat_id=chat_id)
|
||||
return await serialize_chat_for_user(db, user_id=current_user.id, chat=chat)
|
||||
|
||||
|
||||
@@ -339,6 +342,7 @@ async def unarchive_chat(
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> ChatRead:
|
||||
chat = await set_chat_archived_for_user(db, chat_id=chat_id, user_id=current_user.id, archived=False)
|
||||
await realtime_gateway.publish_chat_updated(chat_id=chat_id)
|
||||
return await serialize_chat_for_user(db, user_id=current_user.id, chat=chat)
|
||||
|
||||
|
||||
@@ -349,6 +353,7 @@ async def pin_chat(
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> ChatRead:
|
||||
chat = await set_chat_pinned_for_user(db, chat_id=chat_id, user_id=current_user.id, pinned=True)
|
||||
await realtime_gateway.publish_chat_updated(chat_id=chat_id)
|
||||
return await serialize_chat_for_user(db, user_id=current_user.id, chat=chat)
|
||||
|
||||
|
||||
@@ -359,6 +364,7 @@ async def unpin_chat(
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> ChatRead:
|
||||
chat = await set_chat_pinned_for_user(db, chat_id=chat_id, user_id=current_user.id, pinned=False)
|
||||
await realtime_gateway.publish_chat_updated(chat_id=chat_id)
|
||||
return await serialize_chat_for_user(db, user_id=current_user.id, chat=chat)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user