diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-03-16 21:07:01 +0100 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2016-03-16 21:07:01 +0100 |
commit | 3107f92acb638bb5bf8067daaa5500ae65b5b116 (patch) | |
tree | a738ada4e0aaa8f915c8f1aa5f7f916617b70990 /src/Wallabag/ApiBundle/Controller | |
parent | 17051137ec7cb4273dd2da6bca58e245d648e34a (diff) | |
download | wallabag-3107f92acb638bb5bf8067daaa5500ae65b5b116.tar.gz wallabag-3107f92acb638bb5bf8067daaa5500ae65b5b116.tar.zst wallabag-3107f92acb638bb5bf8067daaa5500ae65b5b116.zip |
Don't add entry through API if it already exists
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/WallabagRestController.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 29cab1f4..2633a311 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php | |||
@@ -112,10 +112,14 @@ class WallabagRestController extends FOSRestController | |||
112 | $isArchived = $request->request->get('archive'); | 112 | $isArchived = $request->request->get('archive'); |
113 | $isStarred = $request->request->get('starred'); | 113 | $isStarred = $request->request->get('starred'); |
114 | 114 | ||
115 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry( | 115 | $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId()); |
116 | new Entry($this->getUser()), | 116 | |
117 | $url | 117 | if (false === $entry) { |
118 | ); | 118 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry( |
119 | new Entry($this->getUser()), | ||
120 | $url | ||
121 | ); | ||
122 | } | ||
119 | 123 | ||
120 | $tags = $request->request->get('tags', ''); | 124 | $tags = $request->request->get('tags', ''); |
121 | if (!empty($tags)) { | 125 | if (!empty($tags)) { |