fix(library): SQL workspace — (workspace != '' OR workspace_id IS NOT NULL)
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.
This commit is contained in:
@@ -445,7 +445,7 @@ async def library_workspace(
|
|||||||
source_type = "all"
|
source_type = "all"
|
||||||
|
|
||||||
uid = _get_user_id(request)
|
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 = []
|
params: list = []
|
||||||
|
|
||||||
if workspace_id:
|
if workspace_id:
|
||||||
|
|||||||
@@ -464,14 +464,8 @@ function libraryPage() {
|
|||||||
try {
|
try {
|
||||||
var url = '/api/library/' + this.tab;
|
var url = '/api/library/' + this.tab;
|
||||||
var sep = '?';
|
var sep = '?';
|
||||||
// Workspace tab: if local workspace is active, show local workspace items
|
if (this.workspaceId && (this.tab === 'recents' || this.tab === 'workspace')) {
|
||||||
if (this.tab === 'workspace' && this.workspaceId && !this.isGiteaActive) {
|
url += sep + 'workspace_id=' + this.workspaceId; sep = '&';
|
||||||
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.tab === 'repository' && this.isGiteaActive) {
|
if (this.tab === 'repository' && this.isGiteaActive) {
|
||||||
url += sep + 'gitea_owner=' + encodeURIComponent(this.giteaOwner) + '&gitea_repo=' + encodeURIComponent(this.giteaRepo);
|
url += sep + 'gitea_owner=' + encodeURIComponent(this.giteaOwner) + '&gitea_repo=' + encodeURIComponent(this.giteaRepo);
|
||||||
@@ -528,12 +522,7 @@ function libraryPage() {
|
|||||||
this.expanded = Object.assign({}, this.expanded);
|
this.expanded = Object.assign({}, this.expanded);
|
||||||
if (!item.children || !item.children.length) {
|
if (!item.children || !item.children.length) {
|
||||||
try {
|
try {
|
||||||
// Route to correct children endpoint based on source type
|
var r = await fetch('/api/library/children/' + item.id);
|
||||||
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 d = await r.json();
|
var d = await r.json();
|
||||||
item.children = d.items || [];
|
item.children = d.items || [];
|
||||||
// Mark the tree for depth calculation
|
// Mark the tree for depth calculation
|
||||||
|
|||||||
Reference in New Issue
Block a user