|
|
@@ -139,6 +139,8 @@ const schema = new Schema<PageDocument, PageModel>({
|
|
|
seenUsers: [{ type: ObjectId, ref: 'User' }],
|
|
|
commentCount: { type: Number, default: 0 },
|
|
|
expandContentWidth: { type: Boolean },
|
|
|
+ wip: { type: Boolean },
|
|
|
+ wipExpiredAt: { type: Date },
|
|
|
updatedAt: { type: Date, default: Date.now }, // Do not use timetamps for updatedAt because it breaks 'updateMetadata: false' option
|
|
|
deleteUser: { type: ObjectId, ref: 'User' },
|
|
|
deletedAt: { type: Date },
|
|
|
@@ -1051,6 +1053,20 @@ schema.methods.calculateAndUpdateLatestRevisionBodyLength = async function(this:
|
|
|
await this.save();
|
|
|
};
|
|
|
|
|
|
+schema.methods.publish = function() {
|
|
|
+ this.wip = undefined;
|
|
|
+ this.wipExpiredAt = undefined;
|
|
|
+};
|
|
|
+
|
|
|
+schema.methods.unpublish = function() {
|
|
|
+ this.wip = true;
|
|
|
+};
|
|
|
+
|
|
|
+schema.methods.makeWip = function() {
|
|
|
+ this.wip = true;
|
|
|
+ this.wipExpiredAt = new Date();
|
|
|
+};
|
|
|
+
|
|
|
/*
|
|
|
* Merge obsolete page model methods and define new methods which depend on crowi instance
|
|
|
*/
|