fix(templates): persist workspace context so template pages actually save
Pages created via the page-template picker (weekly report, project doc, meeting notes, ...) previously got workspace_id=NULL and workspace=login, so they never appeared in the active local/Gitea workspace tree — they looked like they 'didn't save' even though the row existed. Frontend: _useTemplate now sends the active workspace context (workspace_id or workspace key), mirroring _createPlainPage. Backend: use_page_template resolves/validates the workspace and persists both workspace and workspace_id on the new page.
This commit is contained in:
@@ -981,7 +981,12 @@
|
||||
var parts = use.split(':');
|
||||
var body = {};
|
||||
var url;
|
||||
if (parts[0] === 'key') { url = '/board/api/page-templates/0/use'; body = {key: parts.slice(1).join(':')}; }
|
||||
// Pass the current workspace context so the created page is persisted
|
||||
// in the active local/Gitea workspace (mirrors _createPlainPage()).
|
||||
var ctx = self._getContext();
|
||||
if (ctx.wsId > 0) { body.workspace_id = ctx.wsId; }
|
||||
else if (ctx.workspaceKey) { body.workspace = ctx.workspaceKey; }
|
||||
if (parts[0] === 'key') { body.key = parts.slice(1).join(':'); url = '/board/api/page-templates/0/use'; }
|
||||
else { url = '/board/api/page-templates/' + parts[1] + '/use'; }
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user