Fill update note response with real new tags to update sidebar menu

This commit is contained in:
Matias De lellis
2019-11-14 11:44:17 -03:00
parent 4940db0f8e
commit 14ccba7de2

View File

@@ -203,9 +203,6 @@ class NoteController extends Controller {
} }
} }
// Purge orphan tags.
$this->tagmapper->dropOld();
// Set new info on Note // Set new info on Note
$note->setTitle($title); $note->setTitle($title);
$note->setContent($content); $note->setContent($content);
@@ -217,6 +214,9 @@ class NoteController extends Controller {
// Update note. // Update note.
$newnote = $this->notemapper->update($note); $newnote = $this->notemapper->update($note);
// Fill new tags
$newnote->setTags($this->tagmapper->getTagsForNote($this->userId, $newnote->getId()));
// Remove old color if necessary // Remove old color if necessary
if (($oldcolorid !== $hcolor->getId()) && if (($oldcolorid !== $hcolor->getId()) &&
(!$this->notemapper->colorIdCount($oldcolorid))) { (!$this->notemapper->colorIdCount($oldcolorid))) {
@@ -224,6 +224,9 @@ class NoteController extends Controller {
$this->colormapper->delete($oldcolor); $this->colormapper->delete($oldcolor);
} }
// Purge orphan tags.
$this->tagmapper->dropOld();
return new DataResponse($newnote); return new DataResponse($newnote);
} }