aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Wallabag/ApiBundle/Controller/EntryRestController.php6
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
index dfd04fb4..e6bbe552 100644
--- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
@@ -284,6 +284,7 @@ class EntryRestController extends WallabagRestController
284 * {"name"="language", "dataType"="string", "required"=false, "description"="Language of the entry"}, 284 * {"name"="language", "dataType"="string", "required"=false, "description"="Language of the entry"},
285 * {"name"="preview_picture", "dataType"="string", "required"=false, "description"="Preview picture of the entry"}, 285 * {"name"="preview_picture", "dataType"="string", "required"=false, "description"="Preview picture of the entry"},
286 * {"name"="published_at", "dataType"="datetime", "format"="YYYY-MM-DDTHH:II:SS+TZ", "required"=false, "description"="Published date of the entry"}, 286 * {"name"="published_at", "dataType"="datetime", "format"="YYYY-MM-DDTHH:II:SS+TZ", "required"=false, "description"="Published date of the entry"},
287 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
287 * } 288 * }
288 * ) 289 * )
289 * 290 *
@@ -295,12 +296,14 @@ class EntryRestController extends WallabagRestController
295 296
296 $url = $request->request->get('url'); 297 $url = $request->request->get('url');
297 $title = $request->request->get('title'); 298 $title = $request->request->get('title');
299 $tags = $request->request->get('tags', []);
298 $isArchived = $request->request->get('archive'); 300 $isArchived = $request->request->get('archive');
299 $isStarred = $request->request->get('starred'); 301 $isStarred = $request->request->get('starred');
300 $content = $request->request->get('content'); 302 $content = $request->request->get('content');
301 $language = $request->request->get('language'); 303 $language = $request->request->get('language');
302 $picture = $request->request->get('preview_picture'); 304 $picture = $request->request->get('preview_picture');
303 $publishedAt = $request->request->get('published_at'); 305 $publishedAt = $request->request->get('published_at');
306 $authors = $request->request->get('authors', '');
304 307
305 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId()); 308 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId());
306 309
@@ -322,6 +325,7 @@ class EntryRestController extends WallabagRestController
322 'open_graph' => [ 325 'open_graph' => [
323 'og_image' => $picture, 326 'og_image' => $picture,
324 ], 327 ],
328 'authors' => explode(',', $authors),
325 ] 329 ]
326 ); 330 );
327 } catch (\Exception $e) { 331 } catch (\Exception $e) {
@@ -332,7 +336,7 @@ class EntryRestController extends WallabagRestController
332 $entry->setUrl($url); 336 $entry->setUrl($url);
333 } 337 }
334 338
335 $tags = $request->request->get('tags', []); 339
336 if (!empty($tags)) { 340 if (!empty($tags)) {
337 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags); 341 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags);
338 } 342 }
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index 1b0c06d2..e9ba4634 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -345,6 +345,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
345 'content' => 'my content', 345 'content' => 'my content',
346 'language' => 'de_DE', 346 'language' => 'de_DE',
347 'published_at' => '2016-09-08T11:55:58+0200', 347 'published_at' => '2016-09-08T11:55:58+0200',
348 'authors' => 'bob,helen',
348 ]); 349 ]);
349 350
350 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 351 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@@ -361,6 +362,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
361 $this->assertSame('my content', $content['content']); 362 $this->assertSame('my content', $content['content']);
362 $this->assertSame('de_DE', $content['language']); 363 $this->assertSame('de_DE', $content['language']);
363 $this->assertSame('2016-09-08T11:55:58+0200', $content['published_at']); 364 $this->assertSame('2016-09-08T11:55:58+0200', $content['published_at']);
365 $this->assertCount(2, $content['published_by']);
366 $this->assertContains('bob', $content['published_by']);
367 $this->assertContains('helen', $content['published_by']);
364 } 368 }
365 369
366 public function testPostSameEntry() 370 public function testPostSameEntry()