mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-04 16:10:03 +00:00
Merge pull request #2010 from wallabag/set-title-via-post-api
Set the title via POST /api/entries
This commit is contained in:
commit
deb5d97667
2 changed files with 7 additions and 0 deletions
|
@ -109,6 +109,7 @@ class WallabagRestController extends FOSRestController
|
|||
$this->validateAuthentication();
|
||||
|
||||
$url = $request->request->get('url');
|
||||
$title = $request->request->get('title');
|
||||
$isArchived = (int) $request->request->get('archive');
|
||||
$isStarred = (int) $request->request->get('starred');
|
||||
|
||||
|
@ -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);
|
||||
|
|
|
@ -152,6 +152,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
|
|||
$this->client->request('POST', '/api/entries.json', [
|
||||
'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html',
|
||||
'tags' => 'google',
|
||||
'title' => 'New title for my article',
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
|
@ -162,6 +163,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
|
|||
$this->assertEquals('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
|
||||
$this->assertEquals(false, $content['is_archived']);
|
||||
$this->assertEquals(false, $content['is_starred']);
|
||||
$this->assertEquals('New title for my article', $content['title']);
|
||||
$this->assertEquals(1, $content['user_id']);
|
||||
$this->assertCount(1, $content['tags']);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue