Shun Miyazawa 2 лет назад
Родитель
Сommit
9c3355c257
2 измененных файлов с 8 добавлено и 9 удалено
  1. 6 5
      apps/app/src/server/models/page.ts
  2. 2 4
      apps/app/src/server/service/page/index.ts

+ 6 - 5
apps/app/src/server/models/page.ts

@@ -1054,16 +1054,17 @@ schema.methods.calculateAndUpdateLatestRevisionBodyLength = async function(this:
 };
 };
 
 
 schema.methods.publish = function() {
 schema.methods.publish = function() {
-  this.wip = false;
+  this.wip = undefined;
   this.wipExpiredAt = undefined;
   this.wipExpiredAt = undefined;
 };
 };
 
 
-schema.methods.unpublish = function(isNewPage: boolean) {
+schema.methods.unpublish = function() {
   this.wip = true;
   this.wip = true;
+  this.wipExpiredAt = new Date();
+};
 
 
-  if (isNewPage) {
-    this.wipExpiredAt = new Date();
-  }
+schema.methods.makeWip = function() {
+  this.wip = true;
 };
 };
 
 
 /*
 /*

+ 2 - 4
apps/app/src/server/service/page/index.ts

@@ -3793,7 +3793,7 @@ class PageService implements IPageService {
 
 
     // Set wip
     // Set wip
     if (options.wip) {
     if (options.wip) {
-      page.unpublish(true); // isNewPage = true
+      page.unpublish();
     }
     }
 
 
     // Save
     // Save
@@ -4109,9 +4109,7 @@ class PageService implements IPageService {
     const newPageData = pageData;
     const newPageData = pageData;
 
 
     // Do not consider it for automatic deletion if updated at least once
     // Do not consider it for automatic deletion if updated at least once
-    if (newPageData.wipExpiredAt != null) {
-      newPageData.wipExpiredAt = undefined;
-    }
+    newPageData.wipExpiredAt = undefined;
 
 
     // use the previous data if absent
     // use the previous data if absent
     const grant = options.grant ?? clonedPageData.grant;
     const grant = options.grant ?? clonedPageData.grant;