feat(ui,api,telegram): shared conversation panel for obsidian and /admin/panel, bind materializes a window, inbox survives link previews
This commit is contained in:
@@ -448,3 +448,45 @@ async def test_close_distills_a_deep_chat(world: World) -> None:
|
||||
f"/conversations/{branch.external_id}/close", headers=HEADERS
|
||||
)
|
||||
assert plain.status_code == 200 and plain.json()["status"] == "closed"
|
||||
|
||||
|
||||
async def test_bind_without_a_window_materializes_one(world: World) -> None:
|
||||
api = Api(world)
|
||||
chat = await world.conversations.create(kind="deep", agent="d", origin="test")
|
||||
world.markdown.materialized.clear()
|
||||
res = await api.http.post(
|
||||
f"/conversations/{chat.external_id}/bind",
|
||||
json={"frontend": "markdown"},
|
||||
headers=HEADERS,
|
||||
)
|
||||
assert res.status_code == 200, res.text
|
||||
assert world.markdown.materialized == [chat.external_id]
|
||||
assert res.json()["bindings"] == [
|
||||
{
|
||||
"frontend": "markdown",
|
||||
"external_id": f"markdown:{chat.external_id}",
|
||||
"visible": True,
|
||||
}
|
||||
]
|
||||
hidden = await api.http.post(
|
||||
f"/conversations/{chat.external_id}/bind",
|
||||
json={
|
||||
"frontend": "markdown",
|
||||
"external_id": f"markdown:{chat.external_id}",
|
||||
"visible": False,
|
||||
},
|
||||
headers=HEADERS,
|
||||
)
|
||||
assert hidden.json()["bindings"][0]["visible"] is False
|
||||
no_window = await api.http.post(
|
||||
f"/conversations/{chat.external_id}/bind",
|
||||
json={"frontend": "api"},
|
||||
headers=HEADERS,
|
||||
)
|
||||
assert no_window.status_code == 400
|
||||
unknown = await api.http.post(
|
||||
f"/conversations/{chat.external_id}/bind",
|
||||
json={"frontend": "nope"},
|
||||
headers=HEADERS,
|
||||
)
|
||||
assert unknown.status_code == 400
|
||||
|
||||
Reference in New Issue
Block a user