]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Controller/WallabagRestController.php
Starred and Archived clears if article is already exists
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Controller / WallabagRestController.php
index da671a61469a910020dce34811c603b4432cb9f2..b786d4ca2fbfcf2d000402e26d0a195e304eaa50 100644 (file)
@@ -109,8 +109,9 @@ class WallabagRestController extends FOSRestController
         $this->validateAuthentication();
 
         $url = $request->request->get('url');
-        $isArchived = (int) $request->request->get('archive');
-        $isStarred = (int) $request->request->get('starred');
+        $title = $request->request->get('title');
+        $isArchived = $request->request->get('archive');
+        $isStarred = $request->request->get('starred');
 
         $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId());
 
@@ -121,6 +122,10 @@ class WallabagRestController extends FOSRestController
             );
         }
 
+        if (!is_null($title)) {
+            $entry->setTitle($title);
+        }
+
         $tags = $request->request->get('tags', '');
         if (!empty($tags)) {
             $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags);
@@ -384,6 +389,6 @@ class WallabagRestController extends FOSRestController
      */
     private function renderJsonResponse($json)
     {
-        return new Response($json, 200, array('application/json'));
+        return new Response($json, 200, ['application/json']);
     }
 }