|
|
@@ -2383,13 +2383,13 @@ class PageService {
|
|
|
}
|
|
|
|
|
|
async normalizeParentRecursivelyMainOperation(page, user, pageOpId: ObjectIdLike): Promise<void> {
|
|
|
- // Save exDescendantCount for sub-operation
|
|
|
+ // Save prevDescendantCount for sub-operation
|
|
|
const Page = mongoose.model('Page') as unknown as PageModel;
|
|
|
const { PageQueryBuilder } = Page;
|
|
|
const builder = new PageQueryBuilder(Page.findOne(), true);
|
|
|
builder.addConditionAsMigrated();
|
|
|
const exPage = await builder.query.exec();
|
|
|
- const options = { exDescendantCount: exPage?.descendantCount ?? 0 };
|
|
|
+ const options = { prevDescendantCount: exPage?.descendantCount ?? 0 };
|
|
|
|
|
|
try {
|
|
|
await this.normalizeParentRecursively([page.path], user);
|
|
|
@@ -2410,7 +2410,7 @@ class PageService {
|
|
|
await this.normalizeParentRecursivelySubOperation(page, user, pageOp._id, options);
|
|
|
}
|
|
|
|
|
|
- async normalizeParentRecursivelySubOperation(page, user, pageOpId: ObjectIdLike, options: {exDescendantCount: number}): Promise<void> {
|
|
|
+ async normalizeParentRecursivelySubOperation(page, user, pageOpId: ObjectIdLike, options: {prevDescendantCount: number}): Promise<void> {
|
|
|
const Page = mongoose.model('Page') as unknown as PageModel;
|
|
|
|
|
|
try {
|
|
|
@@ -2424,9 +2424,9 @@ class PageService {
|
|
|
throw Error('Page not found after updating descendantCount');
|
|
|
}
|
|
|
|
|
|
- const { exDescendantCount } = options;
|
|
|
+ const { prevDescendantCount } = options;
|
|
|
const newDescendantCount = pageAfterUpdatingDescendantCount.descendantCount;
|
|
|
- const inc = (newDescendantCount - exDescendantCount) + 1;
|
|
|
+ const inc = (newDescendantCount - prevDescendantCount) + 1;
|
|
|
await this.updateDescendantCountOfAncestors(page._id, inc, false);
|
|
|
}
|
|
|
catch (err) {
|