Jelajahi Sumber

Removed grantedUsers parameter from applyScope method on the page model

Taichi Masuyama 3 tahun lalu
induk
melakukan
ec6950a699
1 mengubah file dengan 2 tambahan dan 7 penghapusan
  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');
     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
     // Reset
     this.grantedUsers = [];
     this.grantedUsers = [];
     this.grantedGroup = null;
     this.grantedGroup = null;
@@ -260,7 +255,7 @@ export const getPageSchema = (crowi) => {
     this.grant = grant || GRANT_PUBLIC;
     this.grant = grant || GRANT_PUBLIC;
 
 
     if (grant === GRANT_OWNER) {
     if (grant === GRANT_OWNER) {
-      this.grantedUsers.push(grantedUsers[0] ?? user._id);
+      this.grantedUsers.push(user?._id ?? user);
     }
     }
 
 
     if (grant === GRANT_USER_GROUP) {
     if (grant === GRANT_USER_GROUP) {