fix: Templates should not be visible in collection structure
This commit is contained in:
@ -578,8 +578,10 @@ Document.prototype.archiveWithChildren = async function (userId, options) {
|
||||
Document.prototype.publish = async function (userId: string, options) {
|
||||
if (this.publishedAt) return this.save(options);
|
||||
|
||||
const collection = await Collection.findByPk(this.collectionId);
|
||||
await collection.addDocumentToStructure(this, 0);
|
||||
if (!this.template) {
|
||||
const collection = await Collection.findByPk(this.collectionId);
|
||||
await collection.addDocumentToStructure(this, 0);
|
||||
}
|
||||
|
||||
this.lastModifiedById = userId;
|
||||
this.publishedAt = new Date();
|
||||
@ -636,8 +638,10 @@ Document.prototype.unarchive = async function (userId: string) {
|
||||
if (!parent) this.parentDocumentId = undefined;
|
||||
}
|
||||
|
||||
await collection.addDocumentToStructure(this);
|
||||
this.collection = collection;
|
||||
if (!this.template) {
|
||||
await collection.addDocumentToStructure(this);
|
||||
this.collection = collection;
|
||||
}
|
||||
|
||||
if (this.deletedAt) {
|
||||
await this.restore();
|
||||
|
Reference in New Issue
Block a user