fix: New documents should sort to the top of manually organized collection

This commit is contained in:
Tom Moor 2021-01-30 00:18:56 -08:00
parent ee57f1ccf5
commit eeb7650941
1 changed files with 2 additions and 2 deletions

View File

@ -490,7 +490,7 @@ Document.addHook("afterCreate", async (model) => {
return;
}
await collection.addDocumentToStructure(model);
await collection.addDocumentToStructure(model, 0);
model.collection = collection;
return model;
@ -579,7 +579,7 @@ Document.prototype.publish = async function (options) {
if (this.publishedAt) return this.save(options);
const collection = await Collection.findByPk(this.collectionId);
await collection.addDocumentToStructure(this);
await collection.addDocumentToStructure(this, 0);
this.publishedAt = new Date();
await this.save(options);