|
@@ -40,7 +40,7 @@ const debug = require('debug')('growi:services:page');
|
|
|
const logger = loggerFactory('growi:services:page');
|
|
const logger = loggerFactory('growi:services:page');
|
|
|
const {
|
|
const {
|
|
|
isTrashPage, isTopPage, omitDuplicateAreaPageFromPages,
|
|
isTrashPage, isTopPage, omitDuplicateAreaPageFromPages,
|
|
|
- collectAncestorPaths, isMovablePage, canMoveByPath, isUsersProtectedPages, hasSlash, generateChildrenRegExp,
|
|
|
|
|
|
|
+ collectAncestorPaths, isMovablePage, canMoveByPath, isUsersProtectedPages, hasSlash, generateChildrenRegExp, generateTrashPageChildrenPathRegExp,
|
|
|
} = pagePathUtils;
|
|
} = pagePathUtils;
|
|
|
|
|
|
|
|
const { addTrailingSlash } = pathUtils;
|
|
const { addTrailingSlash } = pathUtils;
|
|
@@ -4035,6 +4035,28 @@ class PageService {
|
|
|
return pages;
|
|
return pages;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Find all pages in trash page
|
|
|
|
|
+ */
|
|
|
|
|
+ async findAllPagesInTrashPage(user: IUserHasId, userGroups = null): Promise<PageDocument[]> {
|
|
|
|
|
+ const Page = mongoose.model('Page') as unknown as PageModel;
|
|
|
|
|
+ const path = '/trash';
|
|
|
|
|
+ const regexp = generateTrashPageChildrenPathRegExp(path);
|
|
|
|
|
+ const queryBuilder = new PageQueryBuilder(Page.find({ path: { $regex: regexp } }), true);
|
|
|
|
|
+
|
|
|
|
|
+ await queryBuilder.addViewerCondition(user, userGroups);
|
|
|
|
|
+
|
|
|
|
|
+ const pages = await queryBuilder
|
|
|
|
|
+ .addConditionToSortPagesByAscPath()
|
|
|
|
|
+ .query
|
|
|
|
|
+ .lean()
|
|
|
|
|
+ .exec();
|
|
|
|
|
+
|
|
|
|
|
+ await this.injectProcessDataIntoPagesByActionTypes(pages, [PageActionType.Rename]);
|
|
|
|
|
+
|
|
|
|
|
+ return pages;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
async findAncestorsChildrenByPathAndViewer(path: string, user, userGroups = null): Promise<Record<string, PageDocument[]>> {
|
|
async findAncestorsChildrenByPathAndViewer(path: string, user, userGroups = null): Promise<Record<string, PageDocument[]>> {
|
|
|
const Page = mongoose.model('Page') as unknown as PageModel;
|
|
const Page = mongoose.model('Page') as unknown as PageModel;
|
|
|
|
|
|