Просмотр исходного кода

Removed grantedUsers parameter from applyScope method on the page model

Taichi Masuyama 3 лет назад
Родитель
Сommit
ec6950a699
1 измененных файлов с 2 добавлено и 7 удалено
  1. 2 7
      packages/app/src/server/models/obsolete-page.js

+ 2 - 7
packages/app/src/server/models/obsolete-page.js

@@ -247,12 +247,7 @@ export const getPageSchema = (crowi) => {
     return this.populate('revision');
   };
 
-  pageSchema.methods.applyScope = function(user, grant, grantUserGroupId, grantedUsers) {
-    // Validate
-    if (grant === GRANT_OWNER && (user == null && grantedUsers?.length !== 1)) {
-      throw Error('The "user" or "grantedUsers" must exist when the grant is GRANT_OWNER.');
-    }
-
+  pageSchema.methods.applyScope = function(user, grant, grantUserGroupId) {
     // Reset
     this.grantedUsers = [];
     this.grantedGroup = null;
@@ -260,7 +255,7 @@ export const getPageSchema = (crowi) => {
     this.grant = grant || GRANT_PUBLIC;
 
     if (grant === GRANT_OWNER) {
-      this.grantedUsers.push(grantedUsers[0] ?? user._id);
+      this.grantedUsers.push(user?._id ?? user);
     }
 
     if (grant === GRANT_USER_GROUP) {