- app.jsxのcomponentMappings
src/server/routes
pages.jsasync function addRenderVarsForDescendants(renderVars, path, requestUser, offset, limit, isRegExpEscapedFromPath) { const SEENER_THRESHOLD = 10; const queryOptions = { offset, limit, includeTrashed: path.startsWith('/trash/'), isRegExpEscapedFromPath, };
- swig でレンダリングする場合はここで設定されている
- APIv3 でも同じようにする必要がある
そのページがTrashかどうか
修正
const { isTrashPage } = require('@commons/util/path-utils');
node.jsではrequire
メソッドを使用して特定のパスを追加する感じですね。
apiv3配下のpages.js
pages.jsrouter.get('/list', accessTokenParser, loginRequired, async(req, res) => { const { path } = req.query; const limit = +req.query.limit || 30; const offset = +req.query.offset || 0; const { isTrashPage } = require('@commons/util/path-utils'); let includeTrashed; if (isTrashPage) { includeTrashed = true; } else { includeTrashed = false; } const queryOptions = { offset, limit, includeTrashed }; try { const result = await Page.findListWithDescendants(path, req.user, queryOptions); return res.apiv3(result); } catch (err) { logger.error('Failed to get Descendants Pages', err); return res.apiv3Err(err, 500); } });