fix(workspace): tags list inclut tous les tags utilisateur (count 0 workspace) pour menu contextuel
FlowDeck CI / lint (push) Successful in 55s
FlowDeck CI / test (push) Successful in 5m52s
FlowDeck CI / docker (push) Successful in 47s

This commit is contained in:
2026-09-14 19:51:21 -04:00
parent 7096707b3e
commit 98af112ba1
+4 -4
View File
@@ -1907,7 +1907,7 @@ async def list_all_tags_global(request: Request):
@router.get("/api/local-workspace/tags")
async def list_tags(request: Request):
"""List tags used in the active workspace (current user's tags only)."""
"""List ALL user tags with counts scoped to the active workspace."""
ws = _get_active_workspace(request, user_id=_get_user_id(request))
ws_id = ws["id"] if ws else None
uid = _get_user_id(request)
@@ -1915,10 +1915,10 @@ async def list_tags(request: Request):
return {"tags": []}
with get_conn() as conn:
rows = conn.execute(
"SELECT DISTINCT t.id, t.name, t.color, COUNT(pt.page_id) as count "
"SELECT t.id, t.name, t.color, COUNT(pt.page_id) as count "
"FROM tags t "
"JOIN page_tags pt ON pt.tag_id = t.id "
"JOIN pages p ON p.id = pt.page_id AND p.workspace_id = ? "
"LEFT JOIN page_tags pt ON pt.tag_id = t.id "
"LEFT JOIN pages p ON p.id = pt.page_id AND p.workspace_id = ? "
"WHERE t.user_id = ? GROUP BY t.id ORDER BY t.name",
(ws_id, uid),
).fetchall()