diff options
author | Phie <phie@phie.ovh> | 2019-05-06 12:58:52 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2019-05-06 12:59:07 +0300 |
commit | 48d12b777074d90791c7ca34decd7a9e1ff72a6d (patch) | |
tree | 9927fad6c0a1843bcf599dc1fd17fa5162cd82b8 /lib/Controller/NoteController.php | |
parent | a13603038025a4653539b7539bacbd6c4f7ea9c6 (diff) |
fix time and keywords after moving a note
Diffstat (limited to 'lib/Controller/NoteController.php')
-rwxr-xr-x | lib/Controller/NoteController.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php index 6fbe672..c3e8429 100755 --- a/lib/Controller/NoteController.php +++ b/lib/Controller/NoteController.php @@ -189,8 +189,12 @@ * @NoCSRFRequired */ public function postKeywordsActions(){ + return $this->internalPostKeywordsActions($_POST["data"]); + } + + private function internalPostKeywordsActions($actions){ $recent = $this->getKeywordsDB(); - foreach($_POST["data"] as $action){ + foreach($actions as $action){ array_push($recent['data'],$action); } $this->internalSaveKeywordsDB(json_encode($recent)); @@ -336,8 +340,11 @@ $thisDbContent = json_decode($inDB->getContent()); $saveDB = false; foreach($thisDbContent->data as $action){ + $isIn = false; foreach($myDbContent->data as $actionMy){ + if($actionMy->time < 10000000000) + $actionMy->time = $actionMy->time * 1000; // fix old bug if($actionMy->time === $action->time && $actionMy->path === $action->path && $actionMy->action === $action->action){ $isIn = true; break; @@ -594,8 +601,9 @@ $actions[0]['action'] = "move"; $actions[0]['path'] = $from; $actions[0]['newPath'] = $to; - $actions[0]['time'] = time(); + $actions[0]['time'] = time()*1000; $this->internalPostActions($actions); + $this->internalPostKeywordsActions($actions); } /** |