From a94794ec81e90b275f5668e4dc42b41bbe6a6757 Mon Sep 17 00:00:00 2001 From: bruno Date: Sun, 19 Jul 2026 14:14:07 -0400 Subject: [PATCH] =?UTF-8?q?fix(library):=20SQL=20workspace=20=E2=80=94=20(?= =?UTF-8?q?workspace=20!=3D=20''=20OR=20workspace=5Fid=20IS=20NOT=20NULL)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les pages du workspace local ont workspace='' mais workspace_id=27. Le filtre workspace != '' les excluait, retournant 0 items. Ajout de OR workspace_id IS NOT NULL pour inclure les pages locales. Simplification du frontend: le workspace tab appelle l'API standard avec workspace_id. --- app/routers/library.py | 2 +- app/templates/library.html | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/app/routers/library.py b/app/routers/library.py index 86f82cb..d0ec287 100644 --- a/app/routers/library.py +++ b/app/routers/library.py @@ -445,7 +445,7 @@ async def library_workspace( source_type = "all" uid = _get_user_id(request) - query = f"{BASE_SELECT} FROM pages p WHERE p.workspace != '' AND p.parent_section != 'Trash' AND p.deleted_at IS NULL" + query = f"{BASE_SELECT} FROM pages p WHERE (p.workspace != '' OR p.workspace_id IS NOT NULL) AND p.parent_section != 'Trash' AND p.deleted_at IS NULL" params: list = [] if workspace_id: diff --git a/app/templates/library.html b/app/templates/library.html index 11bbe2a..4337b3d 100644 --- a/app/templates/library.html +++ b/app/templates/library.html @@ -464,14 +464,8 @@ function libraryPage() { try { var url = '/api/library/' + this.tab; var sep = '?'; - // Workspace tab: if local workspace is active, show local workspace items - if (this.tab === 'workspace' && this.workspaceId && !this.isGiteaActive) { - url = '/api/library/local-workspace' + sep + 'workspace_id=' + this.workspaceId; - sep = '&'; - } else { - if (this.workspaceId && (this.tab === 'recents')) { - url += sep + 'workspace_id=' + this.workspaceId; sep = '&'; - } + if (this.workspaceId && (this.tab === 'recents' || this.tab === 'workspace')) { + url += sep + 'workspace_id=' + this.workspaceId; sep = '&'; } if (this.tab === 'repository' && this.isGiteaActive) { url += sep + 'gitea_owner=' + encodeURIComponent(this.giteaOwner) + '&gitea_repo=' + encodeURIComponent(this.giteaRepo); @@ -528,12 +522,7 @@ function libraryPage() { this.expanded = Object.assign({}, this.expanded); if (!item.children || !item.children.length) { try { - // Route to correct children endpoint based on source type - var childrenUrl = '/api/library/children/' + item.id; - if (item.source_type === 'local-ws') { - childrenUrl = '/api/library/local-workspace-children/' + item.id; - } - var r = await fetch(childrenUrl); + var r = await fetch('/api/library/children/' + item.id); var d = await r.json(); item.children = d.items || []; // Mark the tree for depth calculation