|
|
@@ -19,7 +19,7 @@ import {
|
|
|
import {
|
|
|
IPageOperationProcessInfo, IPageOperationProcessData, PageActionStage, PageActionType,
|
|
|
} from '~/interfaces/page-operation';
|
|
|
-import { IUserHasId } from '~/interfaces/user';
|
|
|
+import { IUser, IUserHasId } from '~/interfaces/user';
|
|
|
import { PageMigrationErrorData, SocketEventName, UpdateDescCountRawData } from '~/interfaces/websocket';
|
|
|
import {
|
|
|
CreateMethod, PageCreateOptions, PageModel, PageDocument, pushRevision, PageQueryBuilder,
|
|
|
@@ -369,7 +369,6 @@ class PageService {
|
|
|
};
|
|
|
|
|
|
const activity = await this.crowi.activityService.createActivity(parameters);
|
|
|
- console.log('What is the activity\n', activity);
|
|
|
|
|
|
const isExist = await Page.exists({ path: newPagePath });
|
|
|
if (isExist) {
|
|
|
@@ -536,8 +535,8 @@ class PageService {
|
|
|
const timerObj = this.crowi.pageOperationService.autoUpdateExpiryDate(pageOpId);
|
|
|
try {
|
|
|
// update descendants first
|
|
|
- const descendantPages = await this.renameDescendantsWithStream(page, newPagePath, user, options, false);
|
|
|
- this.activityEvent.emit('updated', activity, page, descendantPages);
|
|
|
+ const descendantsSubscribedUsers = await this.renameDescendantsWithStream(page, newPagePath, user, options, false);
|
|
|
+ this.activityEvent.emit('updated', activity, page, descendantsSubscribedUsers);
|
|
|
}
|
|
|
catch (err) {
|
|
|
logger.warn(err);
|
|
|
@@ -840,7 +839,7 @@ class PageService {
|
|
|
const renameDescendants = this.renameDescendants.bind(this);
|
|
|
const pageEvent = this.pageEvent;
|
|
|
let count = 0;
|
|
|
- let descendantPages = [];
|
|
|
+ const descendantsSubscribedUsers = [];
|
|
|
const writeStream = new Writable({
|
|
|
objectMode: true,
|
|
|
async write(batch, encoding, callback) {
|
|
|
@@ -849,7 +848,12 @@ class PageService {
|
|
|
await renameDescendants(
|
|
|
batch, user, options, pathRegExp, newPagePathPrefix, shouldUseV4Process,
|
|
|
);
|
|
|
- descendantPages = descendantPages.concat(batch);
|
|
|
+ const subscribedUsers = await Subscription.getSubscriptions(batch);
|
|
|
+ subscribedUsers.forEach((eachUser) => {
|
|
|
+ if (!descendantsSubscribedUsers.includes(eachUser as never)) {
|
|
|
+ descendantsSubscribedUsers.push(eachUser as never);
|
|
|
+ }
|
|
|
+ });
|
|
|
logger.debug(`Renaming pages progressing: (count=${count})`);
|
|
|
}
|
|
|
catch (err) {
|
|
|
@@ -874,7 +878,8 @@ class PageService {
|
|
|
.pipe(writeStream);
|
|
|
|
|
|
await streamToPromise(writeStream);
|
|
|
- return descendantPages;
|
|
|
+ console.log('Who are the subscribed users\n', descendantsSubscribedUsers);
|
|
|
+ return descendantsSubscribedUsers;
|
|
|
}
|
|
|
|
|
|
private async renameDescendantsWithStreamV4(targetPage, newPagePath, user, options = {}) {
|