fix: [objects:edit] Returns the latest state of the object if it were

deleted
pull/6143/head
mokaddem 2020-07-23 16:14:32 +02:00
parent ee8e468c18
commit 2169fe5717
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 2 additions and 1 deletions

View File

@ -432,8 +432,9 @@ class ObjectsController extends AppController
$savedObject = array();
if (is_numeric($objectToSave)) {
$savedObject = $this->MispObject->fetchObjects($this->Auth->user(), array('conditions' => array('Object.id' => $id)));
if (!empty($savedObject) && isset($this->request->data['deleted']) && $this->request->data['deleted']) {
if (isset($this->request->data['deleted']) && $this->request->data['deleted']) {
$this->MispObject->deleteObject($savedObject[0], $hard=false, $unpublish=false);
$savedObject = $this->MispObject->fetchObjects($this->Auth->user(), array('conditions' => array('Object.id' => $id))); // make sure the object is deleted
}
}
// we pre-validate the attributes before we create an object at this point