|
|
@@ -1311,7 +1311,7 @@ module.exports = function(crowi) {
|
|
|
return pageData;
|
|
|
};
|
|
|
|
|
|
- pageSchema.statics.handlePrivatePagesForDeletedGroup = async function(deletedGroup, action, selectedGroupId) {
|
|
|
+ pageSchema.statics.handlePrivatePagesForDeletedGroup = async function(deletedGroup, action, transferToUserGroupId) {
|
|
|
const Page = mongoose.model('Page');
|
|
|
|
|
|
const pages = await this.find({ grantedGroup: deletedGroup });
|
|
|
@@ -1329,7 +1329,7 @@ module.exports = function(crowi) {
|
|
|
break;
|
|
|
case 'transfer':
|
|
|
await Promise.all(pages.map((page) => {
|
|
|
- return Page.transferPageToGroup(page, selectedGroupId);
|
|
|
+ return Page.transferPageToGroup(page, transferToUserGroupId);
|
|
|
}));
|
|
|
break;
|
|
|
default:
|
|
|
@@ -1343,17 +1343,17 @@ module.exports = function(crowi) {
|
|
|
await page.save();
|
|
|
};
|
|
|
|
|
|
- pageSchema.statics.transferPageToGroup = async function(page, selectedGroupId) {
|
|
|
+ pageSchema.statics.transferPageToGroup = async function(page, transferToUserGroupId) {
|
|
|
const UserGroup = mongoose.model('UserGroup');
|
|
|
|
|
|
// check page existence
|
|
|
- const isExist = await UserGroup.count({ _id: selectedGroupId }) > 0;
|
|
|
+ const isExist = await UserGroup.count({ _id: transferToUserGroupId }) > 0;
|
|
|
if (isExist) {
|
|
|
- page.grantedGroup = selectedGroupId;
|
|
|
+ page.grantedGroup = transferToUserGroupId;
|
|
|
await page.save();
|
|
|
}
|
|
|
else {
|
|
|
- throw new Error('Cannot find the group to which private pages belong to. _id: ', selectedGroupId);
|
|
|
+ throw new Error('Cannot find the group to which private pages belong to. _id: ', transferToUserGroupId);
|
|
|
}
|
|
|
};
|
|
|
|