|
@@ -125,6 +125,7 @@ module.exports = (crowi) => {
|
|
|
query('path').optional().isString(),
|
|
query('path').optional().isString(),
|
|
|
query('findAll').optional().isBoolean(),
|
|
query('findAll').optional().isBoolean(),
|
|
|
query('shareLinkId').optional().isMongoId(),
|
|
query('shareLinkId').optional().isMongoId(),
|
|
|
|
|
+ query('includeEmpty').optional().isBoolean(),
|
|
|
],
|
|
],
|
|
|
likes: [
|
|
likes: [
|
|
|
body('pageId').isString(),
|
|
body('pageId').isString(),
|
|
@@ -209,7 +210,7 @@ module.exports = (crowi) => {
|
|
|
router.get('/', certifySharedPage, accessTokenParser, loginRequired, validator.getPage, apiV3FormValidator, async(req, res) => {
|
|
router.get('/', certifySharedPage, accessTokenParser, loginRequired, validator.getPage, apiV3FormValidator, async(req, res) => {
|
|
|
const { user, isSharedPage } = req;
|
|
const { user, isSharedPage } = req;
|
|
|
const {
|
|
const {
|
|
|
- pageId, path, findAll, revisionId, shareLinkId,
|
|
|
|
|
|
|
+ pageId, path, findAll, revisionId, shareLinkId, includeEmpty,
|
|
|
} = req.query;
|
|
} = req.query;
|
|
|
|
|
|
|
|
const isValid = (shareLinkId != null && pageId != null && path == null) || (shareLinkId == null && (pageId != null || path != null));
|
|
const isValid = (shareLinkId != null && pageId != null && path == null) || (shareLinkId == null && (pageId != null || path != null));
|
|
@@ -231,10 +232,10 @@ module.exports = (crowi) => {
|
|
|
page = await Page.findByIdAndViewer(pageId, user);
|
|
page = await Page.findByIdAndViewer(pageId, user);
|
|
|
}
|
|
}
|
|
|
else if (!findAll) {
|
|
else if (!findAll) {
|
|
|
- page = await Page.findByPathAndViewer(path, user, null, true);
|
|
|
|
|
|
|
+ page = await Page.findByPathAndViewer(path, user, null, true, false);
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- pages = await Page.findByPathAndViewer(path, user, null, false);
|
|
|
|
|
|
|
+ pages = await Page.findByPathAndViewer(path, user, null, false, includeEmpty);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|