|
|
@@ -1,11 +1,10 @@
|
|
|
-import { GroupType } from '@growi/core';
|
|
|
+import { GroupType, Origin } from '@growi/core';
|
|
|
import { templateChecker, pagePathUtils, pathUtils } from '@growi/core/dist/utils';
|
|
|
import escapeStringRegexp from 'escape-string-regexp';
|
|
|
|
|
|
import { Comment } from '~/features/comment/server/models/comment';
|
|
|
import ExternalUserGroup from '~/features/external-user-group/server/models/external-user-group';
|
|
|
import ExternalUserGroupRelation from '~/features/external-user-group/server/models/external-user-group-relation';
|
|
|
-import { Origin } from '~/interfaces/apiv3';
|
|
|
import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
import UserGroup from './user-group';
|
|
|
@@ -142,8 +141,10 @@ export const getPageSchema = (crowi) => {
|
|
|
return relations.map((relation) => { return relation.relatedTag.name });
|
|
|
};
|
|
|
|
|
|
- pageSchema.methods.isUpdatable = function(previousRevision, origin) {
|
|
|
- if (origin === Origin.Editor) {
|
|
|
+ pageSchema.methods.isUpdatable = async function(previousRevision, origin) {
|
|
|
+ const populatedPageDataWithRevisionOrigin = await this.populate('revision', 'origin');
|
|
|
+ const latestRevisionOrigin = populatedPageDataWithRevisionOrigin.revision.origin;
|
|
|
+ if (origin === Origin.Editor && (latestRevisionOrigin === Origin.Editor || latestRevisionOrigin === Origin.View)) {
|
|
|
return true;
|
|
|
}
|
|
|
|