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