fix(chats): resolve saved chat detail 500 by importing ChatMemberRead
Some checks failed
CI / test (push) Failing after 2m15s

This commit is contained in:
2026-03-08 22:32:28 +03:00
parent 92f60972de
commit ec3dbddad6
3 changed files with 24 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ from app.chats.schemas import (
ChatCreateRequest,
ChatDeleteRequest,
ChatDiscoverRead,
ChatMemberRead,
ChatJoinByInviteRequest,
ChatNotificationSettingsRead,
ChatNotificationSettingsUpdate,

View File

@@ -11,7 +11,7 @@ Legend:
2. User Profile - `DONE` (username, name, avatar, bio, update)
3. User Status - `PARTIAL` (online/last seen/offline; web now formats `just now/today/yesterday/recently`, backend-side presence heuristics still limited)
4. Contacts - `PARTIAL` (list/search/add/remove/block/unblock; `add by email` flow covered by integration tests including `success/not found/blocked conflict`; web now surfaces specific add-by-email errors (`not found` vs `blocked`); UX moved to menu)
5. Chat List - `DONE` (all/pinned/archive/sort/unread; saved-messages delete behavior covered: clear history without deleting chat)
5. Chat List - `DONE` (all/pinned/archive/sort/unread; saved-messages delete behavior covered: clear history without deleting chat; regression test covers `GET /chats/{saved_id}` detail response)
6. Chat Types - `DONE` (private/group/channel)
7. Chat Creation - `DONE` (private/group/channel)
8. Messages (base) - `DONE` (send/read/edit/delete/delete for all; 7-day edit window enforced and covered by integration tests; group UI shows sender names over bubbles + sender avatars on incoming message clusters)

View File

@@ -135,6 +135,28 @@ async def test_delete_saved_messages_chat_clears_messages_but_keeps_chat(client,
assert messages_after_delete.json() == []
async def test_saved_messages_chat_detail_returns_200(client, db_session):
user = await _create_verified_user(
client,
db_session,
"saved_detail_user@example.com",
"saved_detail_user",
"strongpass123",
)
auth = {"Authorization": f"Bearer {user['access_token']}"}
saved_chat_response = await client.get("/api/v1/chats/saved", headers=auth)
assert saved_chat_response.status_code == 200
saved_chat_id = saved_chat_response.json()["id"]
detail_response = await client.get(f"/api/v1/chats/{saved_chat_id}", headers=auth)
assert detail_response.status_code == 200
payload = detail_response.json()
assert payload["id"] == saved_chat_id
assert payload["is_saved"] is True
assert isinstance(payload["members"], list)
async def test_chat_list_hides_duplicate_saved_chats_and_returns_single_saved_entry(client, db_session):
user = await _create_verified_user(
client,