fix(library): dir=all = union de made+received (page partagée nominale visible dans Tous)
FlowDeck CI / test (push) Failing after 18s
FlowDeck CI / docker (push) Skipped

This commit is contained in:
2026-09-08 11:58:31 -04:00
parent 0112a5b5d8
commit 15cc2d6f21
2 changed files with 14 additions and 3 deletions
+3 -3
View File
@@ -224,12 +224,12 @@ async def library_shared(
params: list = []
if dir in ("all", "made"):
conds.append("p.share_mode != 'private'")
if dir in ("all", "made") and made_ids:
conds.append(f"p.id IN ({','.join('?' for _ in made_ids)})")
params.extend(made_ids)
if dir in ("all", "received") and recv_ids:
conds.append(f"p.id IN ({','.join('?' for _ in recv_ids)})")
params.extend(recv_ids)
if dir == "made" and made_ids:
conds.append(f"p.id IN ({','.join('?' for _ in made_ids)})")
params.extend(made_ids)
if dir == "received" and not recv_ids:
return {"items": []}
+11
View File
@@ -259,6 +259,17 @@ def test_library_shared_dir_all_is_union(client):
assert a in ids
def test_library_shared_dir_all_includes_private_shared_made(client):
_auth(client, user_id=1, login="owner")
with get_conn_ctx() as conn:
a = _make_page_with(conn, "Private Shared A")
client.post(f"/api/pages/{a}/share", json={"user_id": 2, "permission": "comment"})
all_items = client.get("/api/library/shared").json()["items"]
ids = [it["id"] for it in all_items]
assert a in ids, "privately-shared page must appear in 'all' (union made+received)"
def test_library_shared_invalid_dir_falls_back_to_all(client):
_auth(client, user_id=1, login="owner")
with get_conn_ctx() as conn: