From c64f1e619a4d84eda86fd2086e823fa882456c38 Mon Sep 17 00:00:00 2001
From: Tania Fecheta <tania.fecheta@thinslices.com>
Date: Thu, 13 Dec 2018 13:27:27 +0200
Subject: [PATCH] refactor(collection/patch): remove duplcate code and
 unnecesary code

---
 .../src/routes/collections/patch.js                      | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/packages/component-manuscript-manager/src/routes/collections/patch.js b/packages/component-manuscript-manager/src/routes/collections/patch.js
index ce752b64e..d81429c23 100644
--- a/packages/component-manuscript-manager/src/routes/collections/patch.js
+++ b/packages/component-manuscript-manager/src/routes/collections/patch.js
@@ -35,12 +35,9 @@ module.exports = models => async (req, res) => {
       })
     }
 
-    if (collectionStatus) {
-      collection.status = 'deleted'
-      await collection.save()
-      const collectionHelper = new Collection({ collection })
-      collectionHelper.updateStatus({ newStatus: 'deleted' })
-    }
+    const collectionHelper = new Collection({ collection })
+    await collectionHelper.updateStatus({ newStatus: 'deleted' })
+
     return res.status(200).json(collection)
   } catch (e) {
     const notFoundError = await services.handleNotFoundError(e, 'Collection')
-- 
GitLab