mirror of
https://github.com/outline/outline.git
synced 2026-11-21 21:44:30 +03:00
Don't move archive
This commit is contained in:
1 parent
65e5030efd
commit
ab5b3e151a
1 file changed
+4
-16
@@ -197,28 +197,16 @@ Collection.associate = (models) => {
|
||||
};
|
||||
|
||||
Collection.addHook("afterDestroy", async (model: Collection) => {
|
||||
// sets deletedAt attribute of archived, templates and normal documents
|
||||
// sets deletedAt attribute of templates and normal documents
|
||||
await Document.destroy({
|
||||
where: {
|
||||
collectionId: model.id,
|
||||
archivedAt: {
|
||||
[Op.eq]: null,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// updating the documents that moved to deleted state from archived state
|
||||
await Document.update(
|
||||
{
|
||||
archivedAt: null,
|
||||
},
|
||||
{
|
||||
where: {
|
||||
deletedAt: {
|
||||
[Op.ne]: null,
|
||||
},
|
||||
},
|
||||
paranoid: false,
|
||||
}
|
||||
);
|
||||
|
||||
// updating the drafts to have no collection
|
||||
await Document.unscoped().update(
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user