diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2017-06-21 14:51:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-21 14:51:46 +0200 |
commit | 8c68acff2abe0573e287ad9ee4589668d1bb7ffa (patch) | |
tree | 0e67b949bde3bf8c441bfa77cbf9aa0a49326f72 | |
parent | 80784b782becfaa297e6d9cbb0584e27739cffc8 (diff) | |
parent | bd40f1af88979cb5257206d178d26819e350a24c (diff) | |
download | wallabag-8c68acff2abe0573e287ad9ee4589668d1bb7ffa.tar.gz wallabag-8c68acff2abe0573e287ad9ee4589668d1bb7ffa.tar.zst wallabag-8c68acff2abe0573e287ad9ee4589668d1bb7ffa.zip |
Merge pull request #3207 from wallabag/tag-rss
Add RSS for tags
31 files changed, 258 insertions, 103 deletions
diff --git a/app/config/security.yml b/app/config/security.yml index ffb1d356..e14a0bd1 100644 --- a/app/config/security.yml +++ b/app/config/security.yml | |||
@@ -61,6 +61,7 @@ security: | |||
61 | - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } | 61 | - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } |
62 | - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } | 62 | - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } |
63 | - { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } | 63 | - { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } |
64 | - { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } | ||
64 | - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY } | 65 | - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY } |
65 | - { path: ^/settings, roles: ROLE_SUPER_ADMIN } | 66 | - { path: ^/settings, roles: ROLE_SUPER_ADMIN } |
66 | - { path: ^/annotations, roles: ROLE_USER } | 67 | - { path: ^/annotations, roles: ROLE_USER } |
diff --git a/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php b/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php index 65f35d8e..74da1e5f 100644 --- a/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php +++ b/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php | |||
@@ -46,7 +46,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand | |||
46 | return 1; | 46 | return 1; |
47 | } | 47 | } |
48 | } else { | 48 | } else { |
49 | $users = $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findAll(); | 49 | $users = $this->getContainer()->get('wallabag_user.user_repository')->findAll(); |
50 | 50 | ||
51 | $output->writeln(sprintf('Cleaning through %d user accounts', count($users))); | 51 | $output->writeln(sprintf('Cleaning through %d user accounts', count($users))); |
52 | 52 | ||
@@ -66,7 +66,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand | |||
66 | private function cleanDuplicates(User $user) | 66 | private function cleanDuplicates(User $user) |
67 | { | 67 | { |
68 | $em = $this->getContainer()->get('doctrine.orm.entity_manager'); | 68 | $em = $this->getContainer()->get('doctrine.orm.entity_manager'); |
69 | $repo = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry'); | 69 | $repo = $this->getContainer()->get('wallabag_core.entry_repository'); |
70 | 70 | ||
71 | $entries = $repo->getAllEntriesIdAndUrl($user->getId()); | 71 | $entries = $repo->getAllEntriesIdAndUrl($user->getId()); |
72 | 72 | ||
@@ -109,7 +109,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand | |||
109 | */ | 109 | */ |
110 | private function getUser($username) | 110 | private function getUser($username) |
111 | { | 111 | { |
112 | return $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findOneByUserName($username); | 112 | return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); |
113 | } | 113 | } |
114 | 114 | ||
115 | private function getDoctrine() | 115 | private function getDoctrine() |
diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php index e3d3b399..ebb2b4cf 100644 --- a/src/Wallabag/CoreBundle/Command/ExportCommand.php +++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php | |||
@@ -32,15 +32,14 @@ class ExportCommand extends ContainerAwareCommand | |||
32 | protected function execute(InputInterface $input, OutputInterface $output) | 32 | protected function execute(InputInterface $input, OutputInterface $output) |
33 | { | 33 | { |
34 | try { | 34 | try { |
35 | $user = $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findOneByUserName($input->getArgument('username')); | 35 | $user = $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username')); |
36 | } catch (NoResultException $e) { | 36 | } catch (NoResultException $e) { |
37 | $output->writeln(sprintf('<error>User "%s" not found.</error>', $input->getArgument('username'))); | 37 | $output->writeln(sprintf('<error>User "%s" not found.</error>', $input->getArgument('username'))); |
38 | 38 | ||
39 | return 1; | 39 | return 1; |
40 | } | 40 | } |
41 | 41 | ||
42 | $entries = $this->getDoctrine() | 42 | $entries = $this->getContainer()->get('wallabag_core.entry_repository') |
43 | ->getRepository('WallabagCoreBundle:Entry') | ||
44 | ->getBuilderForAllByUser($user->getId()) | 43 | ->getBuilderForAllByUser($user->getId()) |
45 | ->getQuery() | 44 | ->getQuery() |
46 | ->getResult(); | 45 | ->getResult(); |
diff --git a/src/Wallabag/CoreBundle/Command/ShowUserCommand.php b/src/Wallabag/CoreBundle/Command/ShowUserCommand.php index 0eeaabc4..eef04988 100644 --- a/src/Wallabag/CoreBundle/Command/ShowUserCommand.php +++ b/src/Wallabag/CoreBundle/Command/ShowUserCommand.php | |||
@@ -67,7 +67,7 @@ class ShowUserCommand extends ContainerAwareCommand | |||
67 | */ | 67 | */ |
68 | private function getUser($username) | 68 | private function getUser($username) |
69 | { | 69 | { |
70 | return $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findOneByUserName($username); | 70 | return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); |
71 | } | 71 | } |
72 | 72 | ||
73 | private function getDoctrine() | 73 | private function getDoctrine() |
diff --git a/src/Wallabag/CoreBundle/Command/TagAllCommand.php b/src/Wallabag/CoreBundle/Command/TagAllCommand.php index 3f9bb04d..9843674e 100644 --- a/src/Wallabag/CoreBundle/Command/TagAllCommand.php +++ b/src/Wallabag/CoreBundle/Command/TagAllCommand.php | |||
@@ -59,7 +59,7 @@ class TagAllCommand extends ContainerAwareCommand | |||
59 | */ | 59 | */ |
60 | private function getUser($username) | 60 | private function getUser($username) |
61 | { | 61 | { |
62 | return $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findOneByUserName($username); | 62 | return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); |
63 | } | 63 | } |
64 | 64 | ||
65 | private function getDoctrine() | 65 | private function getDoctrine() |
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 89d27425..d4170d39 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -152,8 +152,7 @@ class ConfigController extends Controller | |||
152 | ], | 152 | ], |
153 | 'twofactor_auth' => $this->getParameter('twofactor_auth'), | 153 | 'twofactor_auth' => $this->getParameter('twofactor_auth'), |
154 | 'wallabag_url' => $this->getParameter('domain_name'), | 154 | 'wallabag_url' => $this->getParameter('domain_name'), |
155 | 'enabled_users' => $this->getDoctrine() | 155 | 'enabled_users' => $this->get('wallabag_user.user_repository') |
156 | ->getRepository('WallabagUserBundle:User') | ||
157 | ->getSumEnabledUsers(), | 156 | ->getSumEnabledUsers(), |
158 | ]); | 157 | ]); |
159 | } | 158 | } |
@@ -257,9 +256,7 @@ class ConfigController extends Controller | |||
257 | // manually remove tags to avoid orphan tag | 256 | // manually remove tags to avoid orphan tag |
258 | $this->removeAllTagsByUserId($this->getUser()->getId()); | 257 | $this->removeAllTagsByUserId($this->getUser()->getId()); |
259 | 258 | ||
260 | $this->getDoctrine() | 259 | $this->get('wallabag_core.entry_repository')->removeAllByUserId($this->getUser()->getId()); |
261 | ->getRepository('WallabagCoreBundle:Entry') | ||
262 | ->removeAllByUserId($this->getUser()->getId()); | ||
263 | break; | 260 | break; |
264 | case 'archived': | 261 | case 'archived': |
265 | if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { | 262 | if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { |
@@ -269,9 +266,7 @@ class ConfigController extends Controller | |||
269 | // manually remove tags to avoid orphan tag | 266 | // manually remove tags to avoid orphan tag |
270 | $this->removeTagsForArchivedByUserId($this->getUser()->getId()); | 267 | $this->removeTagsForArchivedByUserId($this->getUser()->getId()); |
271 | 268 | ||
272 | $this->getDoctrine() | 269 | $this->get('wallabag_core.entry_repository')->removeArchivedByUserId($this->getUser()->getId()); |
273 | ->getRepository('WallabagCoreBundle:Entry') | ||
274 | ->removeArchivedByUserId($this->getUser()->getId()); | ||
275 | break; | 270 | break; |
276 | } | 271 | } |
277 | 272 | ||
@@ -295,8 +290,7 @@ class ConfigController extends Controller | |||
295 | return; | 290 | return; |
296 | } | 291 | } |
297 | 292 | ||
298 | $this->getDoctrine() | 293 | $this->get('wallabag_core.entry_repository') |
299 | ->getRepository('WallabagCoreBundle:Entry') | ||
300 | ->removeTags($userId, $tags); | 294 | ->removeTags($userId, $tags); |
301 | 295 | ||
302 | // cleanup orphan tags | 296 | // cleanup orphan tags |
@@ -318,7 +312,7 @@ class ConfigController extends Controller | |||
318 | */ | 312 | */ |
319 | private function removeAllTagsByUserId($userId) | 313 | private function removeAllTagsByUserId($userId) |
320 | { | 314 | { |
321 | $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findAllTags($userId); | 315 | $tags = $this->get('wallabag_core.tag_repository')->findAllTags($userId); |
322 | $this->removeAllTagsByStatusAndUserId($tags, $userId); | 316 | $this->removeAllTagsByStatusAndUserId($tags, $userId); |
323 | } | 317 | } |
324 | 318 | ||
@@ -329,7 +323,7 @@ class ConfigController extends Controller | |||
329 | */ | 323 | */ |
330 | private function removeTagsForArchivedByUserId($userId) | 324 | private function removeTagsForArchivedByUserId($userId) |
331 | { | 325 | { |
332 | $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findForArchivedArticlesByUser($userId); | 326 | $tags = $this->get('wallabag_core.tag_repository')->findForArchivedArticlesByUser($userId); |
333 | $this->removeAllTagsByStatusAndUserId($tags, $userId); | 327 | $this->removeAllTagsByStatusAndUserId($tags, $userId); |
334 | } | 328 | } |
335 | 329 | ||
@@ -393,8 +387,7 @@ class ConfigController extends Controller | |||
393 | */ | 387 | */ |
394 | public function deleteAccountAction(Request $request) | 388 | public function deleteAccountAction(Request $request) |
395 | { | 389 | { |
396 | $enabledUsers = $this->getDoctrine() | 390 | $enabledUsers = $this->get('wallabag_user.user_repository') |
397 | ->getRepository('WallabagUserBundle:User') | ||
398 | ->getSumEnabledUsers(); | 391 | ->getSumEnabledUsers(); |
399 | 392 | ||
400 | if ($enabledUsers <= 1) { | 393 | if ($enabledUsers <= 1) { |
diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index abc3336a..fda04cfb 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php | |||
@@ -7,7 +7,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |||
7 | use Symfony\Component\HttpFoundation\Request; | 7 | use Symfony\Component\HttpFoundation\Request; |
8 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | 8 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
9 | use Wallabag\CoreBundle\Entity\Entry; | 9 | use Wallabag\CoreBundle\Entity\Entry; |
10 | use Wallabag\CoreBundle\Entity\Tag; | ||
11 | 10 | ||
12 | /** | 11 | /** |
13 | * The try/catch can be removed once all formats will be implemented. | 12 | * The try/catch can be removed once all formats will be implemented. |
@@ -57,16 +56,17 @@ class ExportController extends Controller | |||
57 | { | 56 | { |
58 | $method = ucfirst($category); | 57 | $method = ucfirst($category); |
59 | $methodBuilder = 'getBuilderFor'.$method.'ByUser'; | 58 | $methodBuilder = 'getBuilderFor'.$method.'ByUser'; |
59 | $repository = $this->get('wallabag_core.entry_repository'); | ||
60 | 60 | ||
61 | if ($category == 'tag_entries') { | 61 | if ($category == 'tag_entries') { |
62 | $tag = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findOneBySlug($request->query->get('tag')); | 62 | $tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag')); |
63 | 63 | ||
64 | $entries = $this->getDoctrine() | 64 | $entries = $repository->findAllByTagId( |
65 | ->getRepository('WallabagCoreBundle:Entry') | 65 | $this->getUser()->getId(), |
66 | ->findAllByTagId($this->getUser()->getId(), $tag->getId()); | 66 | $tag->getId() |
67 | ); | ||
67 | } else { | 68 | } else { |
68 | $entries = $this->getDoctrine() | 69 | $entries = $repository |
69 | ->getRepository('WallabagCoreBundle:Entry') | ||
70 | ->$methodBuilder($this->getUser()->getId()) | 70 | ->$methodBuilder($this->getUser()->getId()) |
71 | ->getQuery() | 71 | ->getQuery() |
72 | ->getResult(); | 72 | ->getResult(); |
diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php index 92f18707..e87dd9a1 100644 --- a/src/Wallabag/CoreBundle/Controller/RssController.php +++ b/src/Wallabag/CoreBundle/Controller/RssController.php | |||
@@ -3,13 +3,16 @@ | |||
3 | namespace Wallabag\CoreBundle\Controller; | 3 | namespace Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use Pagerfanta\Adapter\DoctrineORMAdapter; | 5 | use Pagerfanta\Adapter\DoctrineORMAdapter; |
6 | use Pagerfanta\Adapter\ArrayAdapter; | ||
6 | use Pagerfanta\Exception\OutOfRangeCurrentPageException; | 7 | use Pagerfanta\Exception\OutOfRangeCurrentPageException; |
7 | use Pagerfanta\Pagerfanta; | 8 | use Pagerfanta\Pagerfanta; |
8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | 9 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; |
9 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 10 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
10 | use Symfony\Component\HttpFoundation\Request; | 11 | use Symfony\Component\HttpFoundation\Request; |
12 | use Symfony\Component\HttpFoundation\Response; | ||
11 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 13 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
12 | use Wallabag\CoreBundle\Entity\Entry; | 14 | use Wallabag\CoreBundle\Entity\Entry; |
15 | use Wallabag\CoreBundle\Entity\Tag; | ||
13 | use Wallabag\UserBundle\Entity\User; | 16 | use Wallabag\UserBundle\Entity\User; |
14 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | 17 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
15 | 18 | ||
@@ -23,7 +26,7 @@ class RssController extends Controller | |||
23 | * | 26 | * |
24 | * @return \Symfony\Component\HttpFoundation\Response | 27 | * @return \Symfony\Component\HttpFoundation\Response |
25 | */ | 28 | */ |
26 | public function showUnreadAction(Request $request, User $user) | 29 | public function showUnreadRSSAction(Request $request, User $user) |
27 | { | 30 | { |
28 | return $this->showEntries('unread', $user, $request->query->get('page', 1)); | 31 | return $this->showEntries('unread', $user, $request->query->get('page', 1)); |
29 | } | 32 | } |
@@ -31,12 +34,12 @@ class RssController extends Controller | |||
31 | /** | 34 | /** |
32 | * Shows read entries for current user. | 35 | * Shows read entries for current user. |
33 | * | 36 | * |
34 | * @Route("/{username}/{token}/archive.xml", name="archive_rss") | 37 | * @Route("/{username}/{token}/archive.xml", name="archive_rss", defaults={"_format"="xml"}) |
35 | * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter") | 38 | * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter") |
36 | * | 39 | * |
37 | * @return \Symfony\Component\HttpFoundation\Response | 40 | * @return \Symfony\Component\HttpFoundation\Response |
38 | */ | 41 | */ |
39 | public function showArchiveAction(Request $request, User $user) | 42 | public function showArchiveRSSAction(Request $request, User $user) |
40 | { | 43 | { |
41 | return $this->showEntries('archive', $user, $request->query->get('page', 1)); | 44 | return $this->showEntries('archive', $user, $request->query->get('page', 1)); |
42 | } | 45 | } |
@@ -44,17 +47,89 @@ class RssController extends Controller | |||
44 | /** | 47 | /** |
45 | * Shows starred entries for current user. | 48 | * Shows starred entries for current user. |
46 | * | 49 | * |
47 | * @Route("/{username}/{token}/starred.xml", name="starred_rss") | 50 | * @Route("/{username}/{token}/starred.xml", name="starred_rss", defaults={"_format"="xml"}) |
48 | * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter") | 51 | * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter") |
49 | * | 52 | * |
50 | * @return \Symfony\Component\HttpFoundation\Response | 53 | * @return \Symfony\Component\HttpFoundation\Response |
51 | */ | 54 | */ |
52 | public function showStarredAction(Request $request, User $user) | 55 | public function showStarredRSSAction(Request $request, User $user) |
53 | { | 56 | { |
54 | return $this->showEntries('starred', $user, $request->query->get('page', 1)); | 57 | return $this->showEntries('starred', $user, $request->query->get('page', 1)); |
55 | } | 58 | } |
56 | 59 | ||
57 | /** | 60 | /** |
61 | * Shows all entries for current user. | ||
62 | * | ||
63 | * @Route("/{username}/{token}/all.xml", name="all_rss", defaults={"_format"="xml"}) | ||
64 | * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter") | ||
65 | * | ||
66 | * @return \Symfony\Component\HttpFoundation\Response | ||
67 | */ | ||
68 | public function showAllRSSAction(Request $request, User $user) | ||
69 | { | ||
70 | return $this->showEntries('all', $user, $request->query->get('page', 1)); | ||
71 | } | ||
72 | |||
73 | /** | ||
74 | * Shows entries associated to a tag for current user. | ||
75 | * | ||
76 | * @Route("/{username}/{token}/tags/{slug}.xml", name="tag_rss", defaults={"_format"="xml"}) | ||
77 | * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter") | ||
78 | * @ParamConverter("tag", options={"mapping": {"slug": "slug"}}) | ||
79 | * | ||
80 | * @return \Symfony\Component\HttpFoundation\Response | ||
81 | */ | ||
82 | public function showTagsAction(Request $request, User $user, Tag $tag) | ||
83 | { | ||
84 | $page = $request->query->get('page', 1); | ||
85 | |||
86 | $url = $this->generateUrl( | ||
87 | 'tag_rss', | ||
88 | [ | ||
89 | 'username' => $user->getUsername(), | ||
90 | 'token' => $user->getConfig()->getRssToken(), | ||
91 | 'slug' => $tag->getSlug(), | ||
92 | ], | ||
93 | UrlGeneratorInterface::ABSOLUTE_URL | ||
94 | ); | ||
95 | |||
96 | $entriesByTag = $this->get('wallabag_core.entry_repository')->findAllByTagId( | ||
97 | $user->getId(), | ||
98 | $tag->getId() | ||
99 | ); | ||
100 | |||
101 | $pagerAdapter = new ArrayAdapter($entriesByTag); | ||
102 | |||
103 | $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare( | ||
104 | $pagerAdapter, | ||
105 | $user | ||
106 | ); | ||
107 | |||
108 | if (null === $entries) { | ||
109 | throw $this->createNotFoundException('No entries found?'); | ||
110 | } | ||
111 | |||
112 | try { | ||
113 | $entries->setCurrentPage($page); | ||
114 | } catch (OutOfRangeCurrentPageException $e) { | ||
115 | if ($page > 1) { | ||
116 | return $this->redirect($url.'?page='.$entries->getNbPages(), 302); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | return $this->render( | ||
121 | '@WallabagCore/themes/common/Entry/entries.xml.twig', | ||
122 | [ | ||
123 | 'url_html' => $this->generateUrl('tag_entries', ['slug' => $tag->getSlug()], UrlGeneratorInterface::ABSOLUTE_URL), | ||
124 | 'type' => 'tag ('.$tag->getLabel().')', | ||
125 | 'url' => $url, | ||
126 | 'entries' => $entries, | ||
127 | ], | ||
128 | new Response('', 200, ['Content-Type' => 'application/rss+xml']) | ||
129 | ); | ||
130 | } | ||
131 | |||
132 | /** | ||
58 | * Global method to retrieve entries depending on the given type | 133 | * Global method to retrieve entries depending on the given type |
59 | * It returns the response to be send. | 134 | * It returns the response to be send. |
60 | * | 135 | * |
@@ -66,7 +141,7 @@ class RssController extends Controller | |||
66 | */ | 141 | */ |
67 | private function showEntries($type, User $user, $page = 1) | 142 | private function showEntries($type, User $user, $page = 1) |
68 | { | 143 | { |
69 | $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry'); | 144 | $repository = $this->get('wallabag_core.entry_repository'); |
70 | 145 | ||
71 | switch ($type) { | 146 | switch ($type) { |
72 | case 'starred': | 147 | case 'starred': |
@@ -81,6 +156,10 @@ class RssController extends Controller | |||
81 | $qb = $repository->getBuilderForUnreadByUser($user->getId()); | 156 | $qb = $repository->getBuilderForUnreadByUser($user->getId()); |
82 | break; | 157 | break; |
83 | 158 | ||
159 | case 'all': | ||
160 | $qb = $repository->getBuilderForAllByUser($user->getId()); | ||
161 | break; | ||
162 | |||
84 | default: | 163 | default: |
85 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); | 164 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); |
86 | } | 165 | } |
@@ -108,10 +187,15 @@ class RssController extends Controller | |||
108 | } | 187 | } |
109 | } | 188 | } |
110 | 189 | ||
111 | return $this->render('@WallabagCore/themes/common/Entry/entries.xml.twig', [ | 190 | return $this->render( |
112 | 'type' => $type, | 191 | '@WallabagCore/themes/common/Entry/entries.xml.twig', |
113 | 'url' => $url, | 192 | [ |
114 | 'entries' => $entries, | 193 | 'url_html' => $this->generateUrl($type, [], UrlGeneratorInterface::ABSOLUTE_URL), |
115 | ]); | 194 | 'type' => $type, |
195 | 'url' => $url, | ||
196 | 'entries' => $entries, | ||
197 | ], | ||
198 | new Response('', 200, ['Content-Type' => 'application/rss+xml']) | ||
199 | ); | ||
116 | } | 200 | } |
117 | } | 201 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 9422bae4..a8b1eadd 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -84,16 +84,17 @@ class TagController extends Controller | |||
84 | */ | 84 | */ |
85 | public function showTagAction() | 85 | public function showTagAction() |
86 | { | 86 | { |
87 | $tags = $this->getDoctrine() | 87 | $repository = $this->get('wallabag_core.entry_repository'); |
88 | ->getRepository('WallabagCoreBundle:Tag') | 88 | $tags = $this->get('wallabag_core.tag_repository') |
89 | ->findAllTags($this->getUser()->getId()); | 89 | ->findAllTags($this->getUser()->getId()); |
90 | 90 | ||
91 | $flatTags = []; | 91 | $flatTags = []; |
92 | 92 | ||
93 | foreach ($tags as $tag) { | 93 | foreach ($tags as $tag) { |
94 | $nbEntries = $this->getDoctrine() | 94 | $nbEntries = $repository->countAllEntriesByUserIdAndTagId( |
95 | ->getRepository('WallabagCoreBundle:Entry') | 95 | $this->getUser()->getId(), |
96 | ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag->getId()); | 96 | $tag->getId() |
97 | ); | ||
97 | 98 | ||
98 | $flatTags[] = [ | 99 | $flatTags[] = [ |
99 | 'id' => $tag->getId(), | 100 | 'id' => $tag->getId(), |
@@ -119,9 +120,10 @@ class TagController extends Controller | |||
119 | */ | 120 | */ |
120 | public function showEntriesForTagAction(Tag $tag, $page, Request $request) | 121 | public function showEntriesForTagAction(Tag $tag, $page, Request $request) |
121 | { | 122 | { |
122 | $entriesByTag = $this->getDoctrine() | 123 | $entriesByTag = $this->get('wallabag_core.entry_repository')->findAllByTagId( |
123 | ->getRepository('WallabagCoreBundle:Entry') | 124 | $this->getUser()->getId(), |
124 | ->findAllByTagId($this->getUser()->getId(), $tag->getId()); | 125 | $tag->getId() |
126 | ); | ||
125 | 127 | ||
126 | $pagerAdapter = new ArrayAdapter($entriesByTag); | 128 | $pagerAdapter = new ArrayAdapter($entriesByTag); |
127 | 129 | ||
@@ -142,7 +144,7 @@ class TagController extends Controller | |||
142 | 'form' => null, | 144 | 'form' => null, |
143 | 'entries' => $entries, | 145 | 'entries' => $entries, |
144 | 'currentPage' => $page, | 146 | 'currentPage' => $page, |
145 | 'tag' => $tag->getSlug(), | 147 | 'tag' => $tag, |
146 | ]); | 148 | ]); |
147 | } | 149 | } |
148 | } | 150 | } |
diff --git a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php index df579ebd..231a0b52 100644 --- a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php +++ b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php | |||
@@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Helper; | |||
4 | 4 | ||
5 | use Pagerfanta\Adapter\AdapterInterface; | 5 | use Pagerfanta\Adapter\AdapterInterface; |
6 | use Pagerfanta\Pagerfanta; | 6 | use Pagerfanta\Pagerfanta; |
7 | use Wallabag\UserBundle\Entity\User; | ||
7 | use Symfony\Component\Routing\Router; | 8 | use Symfony\Component\Routing\Router; |
8 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; | 9 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
9 | 10 | ||
@@ -20,12 +21,15 @@ class PreparePagerForEntries | |||
20 | 21 | ||
21 | /** | 22 | /** |
22 | * @param AdapterInterface $adapter | 23 | * @param AdapterInterface $adapter |
24 | * @param User $user If user isn't logged in, we can force it (like for rss) | ||
23 | * | 25 | * |
24 | * @return null|Pagerfanta | 26 | * @return null|Pagerfanta |
25 | */ | 27 | */ |
26 | public function prepare(AdapterInterface $adapter) | 28 | public function prepare(AdapterInterface $adapter, User $user = null) |
27 | { | 29 | { |
28 | $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; | 30 | if (null === $user) { |
31 | $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; | ||
32 | } | ||
29 | 33 | ||
30 | if (null === $user || !is_object($user)) { | 34 | if (null === $user || !is_object($user)) { |
31 | return; | 35 | return; |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index a91a0ce4..52904d25 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -90,9 +90,10 @@ config: | |||
90 | token_reset: 'Nulstil token' | 90 | token_reset: 'Nulstil token' |
91 | rss_links: 'RSS-Links' | 91 | rss_links: 'RSS-Links' |
92 | rss_link: | 92 | rss_link: |
93 | unread: 'ulæst' | 93 | unread: 'Ulæst' |
94 | starred: 'favoritter' | 94 | starred: 'Favoritter' |
95 | archive: 'arkiv' | 95 | archive: 'Arkiv' |
96 | # all: 'All' | ||
96 | # rss_limit: 'Number of items in the feed' | 97 | # rss_limit: 'Number of items in the feed' |
97 | form_user: | 98 | form_user: |
98 | # two_factor_description: "Enabling two factor authentication means you'll receive an email with a code on every new untrusted connexion" | 99 | # two_factor_description: "Enabling two factor authentication means you'll receive an email with a code on every new untrusted connexion" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index e77cdca3..481b5d05 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -93,6 +93,7 @@ config: | |||
93 | unread: 'Ungelesene' | 93 | unread: 'Ungelesene' |
94 | starred: 'Favoriten' | 94 | starred: 'Favoriten' |
95 | archive: 'Archivierte' | 95 | archive: 'Archivierte' |
96 | # all: 'All' | ||
96 | rss_limit: 'Anzahl der Einträge pro Feed' | 97 | rss_limit: 'Anzahl der Einträge pro Feed' |
97 | form_user: | 98 | form_user: |
98 | two_factor_description: "Wenn du die Zwei-Faktor-Authentifizierung aktivierst, erhältst du eine E-Mail mit einem Code bei jeder nicht vertrauenswürdigen Verbindung" | 99 | two_factor_description: "Wenn du die Zwei-Faktor-Authentifizierung aktivierst, erhältst du eine E-Mail mit einem Code bei jeder nicht vertrauenswürdigen Verbindung" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 50edab3a..98888d05 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -90,9 +90,10 @@ config: | |||
90 | token_reset: 'Regenerate your token' | 90 | token_reset: 'Regenerate your token' |
91 | rss_links: 'RSS links' | 91 | rss_links: 'RSS links' |
92 | rss_link: | 92 | rss_link: |
93 | unread: 'unread' | 93 | unread: 'Unread' |
94 | starred: 'starred' | 94 | starred: 'Starred' |
95 | archive: 'archived' | 95 | archive: 'Archived' |
96 | all: 'All' | ||
96 | rss_limit: 'Number of items in the feed' | 97 | rss_limit: 'Number of items in the feed' |
97 | form_user: | 98 | form_user: |
98 | two_factor_description: "Enabling two factor authentication means you'll receive an email with a code on every new untrusted connection." | 99 | two_factor_description: "Enabling two factor authentication means you'll receive an email with a code on every new untrusted connection." |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 6fbf00eb..310a00de 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -93,6 +93,7 @@ config: | |||
93 | unread: 'sin leer' | 93 | unread: 'sin leer' |
94 | starred: 'favoritos' | 94 | starred: 'favoritos' |
95 | archive: 'archivados' | 95 | archive: 'archivados' |
96 | # all: 'All' | ||
96 | rss_limit: 'Límite de artículos en feed RSS' | 97 | rss_limit: 'Límite de artículos en feed RSS' |
97 | form_user: | 98 | form_user: |
98 | two_factor_description: "Con la autenticación en dos pasos recibirá código por e-mail en cada nueva conexión que no sea de confianza." | 99 | two_factor_description: "Con la autenticación en dos pasos recibirá código por e-mail en cada nueva conexión que no sea de confianza." |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index ad7d6cd9..d5247fc3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -93,6 +93,7 @@ config: | |||
93 | unread: 'خواندهنشده' | 93 | unread: 'خواندهنشده' |
94 | starred: 'برگزیده' | 94 | starred: 'برگزیده' |
95 | archive: 'بایگانی' | 95 | archive: 'بایگانی' |
96 | # all: 'All' | ||
96 | rss_limit: 'محدودیت آر-اس-اس' | 97 | rss_limit: 'محدودیت آر-اس-اس' |
97 | form_user: | 98 | form_user: |
98 | two_factor_description: "با فعالکردن تأیید ۲مرحلهای هر بار که اتصال تأییدنشدهای برقرار شد، به شما یک کد از راه ایمیل فرستاده میشود" | 99 | two_factor_description: "با فعالکردن تأیید ۲مرحلهای هر بار که اتصال تأییدنشدهای برقرار شد، به شما یک کد از راه ایمیل فرستاده میشود" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index c4b029c3..b338eba4 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -88,11 +88,12 @@ config: | |||
88 | no_token: "Aucun jeton généré" | 88 | no_token: "Aucun jeton généré" |
89 | token_create: "Créez votre jeton" | 89 | token_create: "Créez votre jeton" |
90 | token_reset: "Réinitialisez votre jeton" | 90 | token_reset: "Réinitialisez votre jeton" |
91 | rss_links: "Adresse de vos flux RSS" | 91 | rss_links: "Adresses de vos flux RSS" |
92 | rss_link: | 92 | rss_link: |
93 | unread: "non lus" | 93 | unread: "Non lus" |
94 | starred: "favoris" | 94 | starred: "Favoris" |
95 | archive: "lus" | 95 | archive: "Lus" |
96 | all: "Tous" | ||
96 | rss_limit: "Nombre d’articles dans le flux" | 97 | rss_limit: "Nombre d’articles dans le flux" |
97 | form_user: | 98 | form_user: |
98 | two_factor_description: "Activer l’authentification double-facteur veut dire que vous allez recevoir un code par courriel à chaque nouvelle connexion non approuvée." | 99 | two_factor_description: "Activer l’authentification double-facteur veut dire que vous allez recevoir un code par courriel à chaque nouvelle connexion non approuvée." |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 4bd04aad..a3ff5495 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -90,9 +90,10 @@ config: | |||
90 | token_reset: 'Rigenera il tuo token' | 90 | token_reset: 'Rigenera il tuo token' |
91 | rss_links: 'Collegamenti RSS' | 91 | rss_links: 'Collegamenti RSS' |
92 | rss_link: | 92 | rss_link: |
93 | unread: 'non letti' | 93 | unread: 'Non letti' |
94 | starred: 'preferiti' | 94 | starred: 'Preferiti' |
95 | archive: 'archiviati' | 95 | archive: 'Archiviati' |
96 | # all: 'All' | ||
96 | rss_limit: 'Numero di elementi nel feed' | 97 | rss_limit: 'Numero di elementi nel feed' |
97 | form_user: | 98 | form_user: |
98 | two_factor_description: "Abilitando l'\autenticazione a due fattori riceverai una e-mail con un codice per ogni nuova connesione non verificata" | 99 | two_factor_description: "Abilitando l'\autenticazione a due fattori riceverai una e-mail con un codice per ogni nuova connesione non verificata" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index a6dd4dcd..a6566a12 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -88,11 +88,12 @@ config: | |||
88 | no_token: 'Pas cap de geton generat' | 88 | no_token: 'Pas cap de geton generat' |
89 | token_create: 'Creatz vòstre geton' | 89 | token_create: 'Creatz vòstre geton' |
90 | token_reset: 'Reïnicializatz vòstre geton' | 90 | token_reset: 'Reïnicializatz vòstre geton' |
91 | rss_links: 'URL de vòstres fluxes RSS' | 91 | rss_links: 'URLs de vòstres fluxes RSS' |
92 | rss_link: | 92 | rss_link: |
93 | unread: 'pas legits' | 93 | unread: 'Pas legits' |
94 | starred: 'favorits' | 94 | starred: 'Favorits' |
95 | archive: 'legits' | 95 | archive: 'Legits' |
96 | # all: 'All' | ||
96 | rss_limit: "Nombre d'articles dins un flux RSS" | 97 | rss_limit: "Nombre d'articles dins un flux RSS" |
97 | form_user: | 98 | form_user: |
98 | two_factor_description: "Activar l'autentificacion doble-factor vòl dire que recebretz un còdi per corrièl per cada novèla connexion pas aprovada." | 99 | two_factor_description: "Activar l'autentificacion doble-factor vòl dire que recebretz un còdi per corrièl per cada novèla connexion pas aprovada." |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 7312abd7..8e1276d9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -90,9 +90,10 @@ config: | |||
90 | token_reset: 'Zresetuj swojego tokena' | 90 | token_reset: 'Zresetuj swojego tokena' |
91 | rss_links: 'RSS links' | 91 | rss_links: 'RSS links' |
92 | rss_link: | 92 | rss_link: |
93 | unread: 'nieprzeczytane' | 93 | unread: 'Nieprzeczytane' |
94 | starred: 'oznaczone gwiazdką' | 94 | starred: 'Oznaczone gwiazdką' |
95 | archive: 'archiwum' | 95 | archive: 'Archiwum' |
96 | # all: 'All' | ||
96 | rss_limit: 'Link do RSS' | 97 | rss_limit: 'Link do RSS' |
97 | form_user: | 98 | form_user: |
98 | two_factor_description: "Włączenie autoryzacji dwuetapowej oznacza, że będziesz otrzymywał maile z kodem przy każdym nowym, niezaufanym połączeniu" | 99 | two_factor_description: "Włączenie autoryzacji dwuetapowej oznacza, że będziesz otrzymywał maile z kodem przy każdym nowym, niezaufanym połączeniu" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index 18090352..953c86bb 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml | |||
@@ -90,9 +90,10 @@ config: | |||
90 | token_reset: 'Gerar novamente seu token' | 90 | token_reset: 'Gerar novamente seu token' |
91 | rss_links: 'Links RSS' | 91 | rss_links: 'Links RSS' |
92 | rss_link: | 92 | rss_link: |
93 | unread: 'não lido' | 93 | unread: 'Não lido' |
94 | starred: 'destacado' | 94 | starred: 'Destacado' |
95 | archive: 'arquivado' | 95 | archive: 'Arquivado' |
96 | # all: 'All' | ||
96 | rss_limit: 'Número de itens no feed' | 97 | rss_limit: 'Número de itens no feed' |
97 | form_user: | 98 | form_user: |
98 | two_factor_description: 'Habilitar autenticação de dois passos significa que você receberá um e-mail com um código a cada nova conexão desconhecida.' | 99 | two_factor_description: 'Habilitar autenticação de dois passos significa que você receberá um e-mail com um código a cada nova conexão desconhecida.' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index f8866fdc..51dbbcaf 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -90,9 +90,10 @@ config: | |||
90 | token_reset: 'Resetează-ți token-ul' | 90 | token_reset: 'Resetează-ți token-ul' |
91 | rss_links: 'Link-uri RSS' | 91 | rss_links: 'Link-uri RSS' |
92 | rss_link: | 92 | rss_link: |
93 | unread: 'unread' | 93 | unread: 'Unread' |
94 | starred: 'starred' | 94 | starred: 'Starred' |
95 | archive: 'archived' | 95 | archive: 'Archived' |
96 | # all: 'All' | ||
96 | rss_limit: 'Limită RSS' | 97 | rss_limit: 'Limită RSS' |
97 | form_user: | 98 | form_user: |
98 | # two_factor_description: "Enabling two factor authentication means you'll receive an email with a code on every new untrusted connexion" | 99 | # two_factor_description: "Enabling two factor authentication means you'll receive an email with a code on every new untrusted connexion" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 4d01e7f7..ff19e9d9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -90,9 +90,10 @@ config: | |||
90 | token_reset: 'Belirteci (token) sıfırla' | 90 | token_reset: 'Belirteci (token) sıfırla' |
91 | rss_links: 'RSS akış bağlantıları' | 91 | rss_links: 'RSS akış bağlantıları' |
92 | rss_link: | 92 | rss_link: |
93 | unread: 'okunmayan' | 93 | unread: 'Okunmayan' |
94 | starred: 'favoriler' | 94 | starred: 'Favoriler' |
95 | archive: 'arşiv' | 95 | archive: 'Arşiv' |
96 | # all: 'All' | ||
96 | rss_limit: 'RSS içeriğinden talep edilecek makale limiti' | 97 | rss_limit: 'RSS içeriğinden talep edilecek makale limiti' |
97 | form_user: | 98 | form_user: |
98 | two_factor_description: "İki adımlı doğrulamayı aktifleştirdiğinizde, her yeni güvenilmeyen bağlantılarda size e-posta ile bir kod alacaksınız." | 99 | two_factor_description: "İki adımlı doğrulamayı aktifleştirdiğinizde, her yeni güvenilmeyen bağlantılarda size e-posta ile bir kod alacaksınız." |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig index 01f63a7b..2bf64cd6 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig | |||
@@ -82,7 +82,7 @@ | |||
82 | <fieldset class="w500p inline"> | 82 | <fieldset class="w500p inline"> |
83 | <div class="row"> | 83 | <div class="row"> |
84 | <h3>{{ 'config.form_settings.android_configuration'|trans }}</h3> | 84 | <h3>{{ 'config.form_settings.android_configuration'|trans }}</h3> |
85 | <a href="wallabag://{{ app.user.username }}@{{ wallabag_url }}" >Touch here to prefill your Android application</a> | 85 | <a href="wallabag://{{ app.user.username }}@{{ wallabag_url }}">Touch here to prefill your Android application</a> |
86 | <br/> | 86 | <br/> |
87 | <img id="androidQrcode" /> | 87 | <img id="androidQrcode" /> |
88 | <script> | 88 | <script> |
@@ -106,7 +106,7 @@ | |||
106 | 106 | ||
107 | <fieldset class="w500p inline"> | 107 | <fieldset class="w500p inline"> |
108 | <div class="row"> | 108 | <div class="row"> |
109 | <label>Rss token</label> | 109 | <label>{{ 'config.form_rss.token_label'|trans }}</label> |
110 | {% if rss.token %} | 110 | {% if rss.token %} |
111 | {{ rss.token }} | 111 | {{ rss.token }} |
112 | {% else %} | 112 | {% else %} |
@@ -128,9 +128,10 @@ | |||
128 | <div class="row"> | 128 | <div class="row"> |
129 | <label>{{ 'config.form_rss.rss_links'|trans }}</label> | 129 | <label>{{ 'config.form_rss.rss_links'|trans }}</label> |
130 | <ul> | 130 | <ul> |
131 | <li><a href="{{ path('unread_rss', {'username': rss.username, 'token': rss.token}) }}">unread</a></li> | 131 | <li><a href="{{ path('unread_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.unread'|trans }}</a></li> |
132 | <li><a href="{{ path('starred_rss', {'username': rss.username, 'token': rss.token}) }}">fav</a></li> | 132 | <li><a href="{{ path('starred_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.starred'|trans }}</a></li> |
133 | <li><a href="{{ path('archive_rss', {'username': rss.username, 'token': rss.token}) }}">archives</a></li> | 133 | <li><a href="{{ path('archive_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.archive'|trans }}</a></li> |
134 | <li><a href="{{ path('all_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.all'|trans }}</a></li> | ||
134 | </ul> | 135 | </ul> |
135 | </div> | 136 | </div> |
136 | </fieldset> | 137 | </fieldset> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index 6c26d5bf..6424df8d 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig | |||
@@ -1,5 +1,12 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | 2 | ||
3 | {% block head %} | ||
4 | {{ parent() }} | ||
5 | {% if tag is defined and app.user.config.rssToken %} | ||
6 | <link rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" /> | ||
7 | {% endif %} | ||
8 | {% endblock %} | ||
9 | |||
3 | {% block title %} | 10 | {% block title %} |
4 | {% set filter = '' %} | 11 | {% set filter = '' %} |
5 | {% if tag is defined %} | 12 | {% if tag is defined %} |
@@ -12,12 +19,15 @@ | |||
12 | {% endblock %} | 19 | {% endblock %} |
13 | 20 | ||
14 | {% block content %} | 21 | {% block content %} |
15 | 22 | {% set currentRoute = app.request.attributes.get('_route') %} | |
16 | {% set listMode = app.user.config.listMode %} | 23 | {% set listMode = app.user.config.listMode %} |
17 | <div class="results"> | 24 | <div class="results"> |
18 | <div class="nb-results">{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}</div> | 25 | <div class="nb-results">{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}</div> |
19 | <div class="pagination"> | 26 | <div class="pagination"> |
20 | <a href="{{ path('switch_view_mode') }}"><i class="listMode-btn material-icons md-24">{% if listMode == 0 %}list{% else %}view_module{% endif %}</i></a> | 27 | <a href="{{ path('switch_view_mode') }}"><i class="listMode-btn material-icons md-24">{% if listMode == 0 %}list{% else %}view_module{% endif %}</i></a> |
28 | {% if app.user.config.rssToken %} | ||
29 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} | ||
30 | {% endif %} | ||
21 | <i class="btn-clickable download-btn material-icons md-24 js-export-action">file_download</i> | 31 | <i class="btn-clickable download-btn material-icons md-24 js-export-action">file_download</i> |
22 | <i class="btn-clickable filter-btn material-icons md-24 js-filters-action">filter_list</i> | 32 | <i class="btn-clickable filter-btn material-icons md-24 js-filters-action">filter_list</i> |
23 | {% if entries.getNbPages > 1 %} | 33 | {% if entries.getNbPages > 1 %} |
@@ -76,7 +86,6 @@ | |||
76 | 86 | ||
77 | <!-- Export --> | 87 | <!-- Export --> |
78 | <aside id="download-form"> | 88 | <aside id="download-form"> |
79 | {% set currentRoute = app.request.attributes.get('_route') %} | ||
80 | {% set currentTag = '' %} | 89 | {% set currentTag = '' %} |
81 | {% if tag is defined %} | 90 | {% if tag is defined %} |
82 | {% set currentTag = tag %} | 91 | {% set currentTag = tag %} |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig index 7509918e..070d5629 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig | |||
@@ -9,7 +9,12 @@ | |||
9 | 9 | ||
10 | <ul> | 10 | <ul> |
11 | {% for tag in tags %} | 11 | {% for tag in tags %} |
12 | <li id="tag-{{ tag.id|e }}"><a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{tag.label}} ({{ tag.nbEntries }})</a></li> | 12 | <li id="tag-{{ tag.id|e }}"> |
13 | <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{tag.label}} ({{ tag.nbEntries }})</a> | ||
14 | <a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="right"> | ||
15 | <i class="material-icons md-24">rss_feed</i> | ||
16 | </a> | ||
17 | </li> | ||
13 | {% endfor %} | 18 | {% endfor %} |
14 | </ul> | 19 | </ul> |
15 | 20 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_rss_link.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_rss_link.html.twig new file mode 100644 index 00000000..2bf9b2bd --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_rss_link.html.twig | |||
@@ -0,0 +1,6 @@ | |||
1 | {% if tag is defined %} | ||
2 | <a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="right"><i class="material-icons md-24">rss_feed</i></a> | ||
3 | {% elseif currentRoute in ['unread', 'starred', 'archive', 'all'] %} | ||
4 | <a rel="alternate" type="application/rss+xml" href="{{ path(currentRoute ~ '_rss', {'username': app.user.username, 'token': app.user.config.rssToken}) }}" class="right"><i class="material-icons">rss_feed</i></a> | ||
5 | {% endif %} | ||
6 | |||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig index 12e8c79f..d70aa5dc 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig | |||
@@ -1,8 +1,8 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/"> | 2 | <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/"> |
3 | <channel> | 3 | <channel> |
4 | <title>wallabag — {{type}} feed</title> | 4 | <title>wallabag - {{ type }} feed</title> |
5 | <link>{{ url(type) }}</link> | 5 | <link>{{ url_html }}</link> |
6 | <link rel="self" href="{{ app.request.uri }}"/> | 6 | <link rel="self" href="{{ app.request.uri }}"/> |
7 | {% if entries.hasPreviousPage -%} | 7 | {% if entries.hasPreviousPage -%} |
8 | <link rel="previous" href="{{ url }}?page={{ entries.previousPage }}"/> | 8 | <link rel="previous" href="{{ url }}?page={{ entries.previousPage }}"/> |
@@ -13,7 +13,7 @@ | |||
13 | <link rel="last" href="{{ url }}?page={{ entries.nbPages }}"/> | 13 | <link rel="last" href="{{ url }}?page={{ entries.nbPages }}"/> |
14 | <pubDate>{{ "now"|date('D, d M Y H:i:s') }}</pubDate> | 14 | <pubDate>{{ "now"|date('D, d M Y H:i:s') }}</pubDate> |
15 | <generator>wallabag</generator> | 15 | <generator>wallabag</generator> |
16 | <description>wallabag {{type}} elements</description> | 16 | <description>wallabag {{ type }} elements</description> |
17 | 17 | ||
18 | {% for entry in entries %} | 18 | {% for entry in entries %} |
19 | 19 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig index 1e10bf38..f290cb49 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig | |||
@@ -157,6 +157,7 @@ | |||
157 | <li><a href="{{ path('unread_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.unread'|trans }}</a></li> | 157 | <li><a href="{{ path('unread_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.unread'|trans }}</a></li> |
158 | <li><a href="{{ path('starred_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.starred'|trans }}</a></li> | 158 | <li><a href="{{ path('starred_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.starred'|trans }}</a></li> |
159 | <li><a href="{{ path('archive_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.archive'|trans }}</a></li> | 159 | <li><a href="{{ path('archive_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.archive'|trans }}</a></li> |
160 | <li><a href="{{ path('all_rss', {'username': rss.username, 'token': rss.token}) }}">{{ 'config.form_rss.rss_link.all'|trans }}</a></li> | ||
160 | </ul> | 161 | </ul> |
161 | </div> | 162 | </div> |
162 | </div> | 163 | </div> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index 5ba42057..0c4dc80b 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig | |||
@@ -1,9 +1,16 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | 2 | ||
3 | {% block head %} | ||
4 | {{ parent() }} | ||
5 | {% if tag is defined and app.user.config.rssToken %} | ||
6 | <link rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" /> | ||
7 | {% endif %} | ||
8 | {% endblock %} | ||
9 | |||
3 | {% block title %} | 10 | {% block title %} |
4 | {% set filter = '' %} | 11 | {% set filter = '' %} |
5 | {% if tag is defined %} | 12 | {% if tag is defined %} |
6 | {% set filter = tag %} | 13 | {% set filter = tag.slug %} |
7 | {% endif %} | 14 | {% endif %} |
8 | {% if searchTerm is defined and searchTerm is not empty %} | 15 | {% if searchTerm is defined and searchTerm is not empty %} |
9 | {% set filter = searchTerm %} | 16 | {% set filter = searchTerm %} |
@@ -13,10 +20,14 @@ | |||
13 | 20 | ||
14 | {% block content %} | 21 | {% block content %} |
15 | {% set listMode = app.user.config.listMode %} | 22 | {% set listMode = app.user.config.listMode %} |
23 | {% set currentRoute = app.request.attributes.get('_route') %} | ||
16 | <div class="results clearfix"> | 24 | <div class="results clearfix"> |
17 | <div class="nb-results left"> | 25 | <div class="nb-results left"> |
18 | {{ 'entry.list.number_on_the_page'|transchoice(entries.count) }} | 26 | {{ 'entry.list.number_on_the_page'|transchoice(entries.count) }} |
19 | <a href="{{ path('switch_view_mode') }}"><i class="material-icons">{% if listMode == 0 %}view_list{% else %}view_module{% endif %}</i></a> | 27 | <a href="{{ path('switch_view_mode') }}"><i class="material-icons">{% if listMode == 0 %}view_list{% else %}view_module{% endif %}</i></a> |
28 | {% if app.user.config.rssToken %} | ||
29 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} | ||
30 | {% endif %} | ||
20 | </div> | 31 | </div> |
21 | {% if entries.getNbPages > 1 %} | 32 | {% if entries.getNbPages > 1 %} |
22 | {{ pagerfanta(entries, 'twitter_bootstrap_translated', {'proximity': 1}) }} | 33 | {{ pagerfanta(entries, 'twitter_bootstrap_translated', {'proximity': 1}) }} |
@@ -46,10 +57,9 @@ | |||
46 | 57 | ||
47 | <!-- Export --> | 58 | <!-- Export --> |
48 | <div id="export" class="side-nav right-aligned"> | 59 | <div id="export" class="side-nav right-aligned"> |
49 | {% set currentRoute = app.request.attributes.get('_route') %} | ||
50 | {% set currentTag = '' %} | 60 | {% set currentTag = '' %} |
51 | {% if tag is defined %} | 61 | {% if tag is defined %} |
52 | {% set currentTag = tag %} | 62 | {% set currentTag = tag.slug %} |
53 | {% endif %} | 63 | {% endif %} |
54 | {% if currentRoute == 'homepage' %} | 64 | {% if currentRoute == 'homepage' %} |
55 | {% set currentRoute = 'unread' %} | 65 | {% set currentRoute = 'unread' %} |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig index c83543ac..97ddedc9 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig | |||
@@ -14,6 +14,9 @@ | |||
14 | {% for tag in tags %} | 14 | {% for tag in tags %} |
15 | <li title="{{tag.label}} ({{ tag.nbEntries }})" id="tag-{{ tag.id }}" class="col l2 m2 s5"> | 15 | <li title="{{tag.label}} ({{ tag.nbEntries }})" id="tag-{{ tag.id }}" class="col l2 m2 s5"> |
16 | <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{tag.label}} ({{ tag.nbEntries }})</a> | 16 | <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{tag.label}} ({{ tag.nbEntries }})</a> |
17 | {% if app.user.config.rssToken %} | ||
18 | <a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="right"><i class="material-icons">rss_feed</i></a> | ||
19 | {% endif %} | ||
17 | </li> | 20 | </li> |
18 | {% endfor %} | 21 | {% endfor %} |
19 | </ul> | 22 | </ul> |
diff --git a/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php b/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php index 5a59654d..530c8bbf 100644 --- a/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php | |||
@@ -6,7 +6,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | |||
6 | 6 | ||
7 | class RssControllerTest extends WallabagCoreTestCase | 7 | class RssControllerTest extends WallabagCoreTestCase |
8 | { | 8 | { |
9 | public function validateDom($xml, $type, $nb = null) | 9 | public function validateDom($xml, $type, $urlPagination, $nb = null) |
10 | { | 10 | { |
11 | $doc = new \DOMDocument(); | 11 | $doc = new \DOMDocument(); |
12 | $doc->loadXML($xml); | 12 | $doc->loadXML($xml); |
@@ -23,7 +23,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
23 | $this->assertEquals(1, $xpath->query('/rss/channel')->length); | 23 | $this->assertEquals(1, $xpath->query('/rss/channel')->length); |
24 | 24 | ||
25 | $this->assertEquals(1, $xpath->query('/rss/channel/title')->length); | 25 | $this->assertEquals(1, $xpath->query('/rss/channel/title')->length); |
26 | $this->assertEquals('wallabag — '.$type.' feed', $xpath->query('/rss/channel/title')->item(0)->nodeValue); | 26 | $this->assertEquals('wallabag - '.$type.' feed', $xpath->query('/rss/channel/title')->item(0)->nodeValue); |
27 | 27 | ||
28 | $this->assertEquals(1, $xpath->query('/rss/channel/pubDate')->length); | 28 | $this->assertEquals(1, $xpath->query('/rss/channel/pubDate')->length); |
29 | 29 | ||
@@ -34,10 +34,10 @@ class RssControllerTest extends WallabagCoreTestCase | |||
34 | $this->assertEquals('wallabag '.$type.' elements', $xpath->query('/rss/channel/description')->item(0)->nodeValue); | 34 | $this->assertEquals('wallabag '.$type.' elements', $xpath->query('/rss/channel/description')->item(0)->nodeValue); |
35 | 35 | ||
36 | $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="self"]')->length); | 36 | $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="self"]')->length); |
37 | $this->assertContains($type.'.xml', $xpath->query('/rss/channel/link[@rel="self"]')->item(0)->getAttribute('href')); | 37 | $this->assertContains($urlPagination.'.xml', $xpath->query('/rss/channel/link[@rel="self"]')->item(0)->getAttribute('href')); |
38 | 38 | ||
39 | $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="last"]')->length); | 39 | $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="last"]')->length); |
40 | $this->assertContains($type.'.xml?page=', $xpath->query('/rss/channel/link[@rel="last"]')->item(0)->getAttribute('href')); | 40 | $this->assertContains($urlPagination.'.xml?page=', $xpath->query('/rss/channel/link[@rel="last"]')->item(0)->getAttribute('href')); |
41 | 41 | ||
42 | foreach ($xpath->query('//item') as $item) { | 42 | foreach ($xpath->query('//item') as $item) { |
43 | $this->assertEquals(1, $xpath->query('title', $item)->length); | 43 | $this->assertEquals(1, $xpath->query('title', $item)->length); |
@@ -94,7 +94,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
94 | 94 | ||
95 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 95 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
96 | 96 | ||
97 | $this->validateDom($client->getResponse()->getContent(), 'unread', 2); | 97 | $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread', 2); |
98 | } | 98 | } |
99 | 99 | ||
100 | public function testStarred() | 100 | public function testStarred() |
@@ -116,7 +116,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
116 | 116 | ||
117 | $this->assertEquals(200, $client->getResponse()->getStatusCode(), 1); | 117 | $this->assertEquals(200, $client->getResponse()->getStatusCode(), 1); |
118 | 118 | ||
119 | $this->validateDom($client->getResponse()->getContent(), 'starred'); | 119 | $this->validateDom($client->getResponse()->getContent(), 'starred', 'starred'); |
120 | } | 120 | } |
121 | 121 | ||
122 | public function testArchives() | 122 | public function testArchives() |
@@ -138,7 +138,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
138 | 138 | ||
139 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 139 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
140 | 140 | ||
141 | $this->validateDom($client->getResponse()->getContent(), 'archive'); | 141 | $this->validateDom($client->getResponse()->getContent(), 'archive', 'archive'); |
142 | } | 142 | } |
143 | 143 | ||
144 | public function testPagination() | 144 | public function testPagination() |
@@ -159,13 +159,38 @@ class RssControllerTest extends WallabagCoreTestCase | |||
159 | 159 | ||
160 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml'); | 160 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml'); |
161 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 161 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
162 | $this->validateDom($client->getResponse()->getContent(), 'unread'); | 162 | $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread'); |
163 | 163 | ||
164 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=2'); | 164 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=2'); |
165 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 165 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
166 | $this->validateDom($client->getResponse()->getContent(), 'unread'); | 166 | $this->validateDom($client->getResponse()->getContent(), 'unread', 'unread'); |
167 | 167 | ||
168 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=3000'); | 168 | $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=3000'); |
169 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 169 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
170 | } | 170 | } |
171 | |||
172 | public function testTags() | ||
173 | { | ||
174 | $client = $this->getClient(); | ||
175 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | ||
176 | $user = $em | ||
177 | ->getRepository('WallabagUserBundle:User') | ||
178 | ->findOneByUsername('admin'); | ||
179 | |||
180 | $config = $user->getConfig(); | ||
181 | $config->setRssToken('SUPERTOKEN'); | ||
182 | $config->setRssLimit(null); | ||
183 | $em->persist($config); | ||
184 | $em->flush(); | ||
185 | |||
186 | $client = $this->getClient(); | ||
187 | $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml'); | ||
188 | |||
189 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
190 | |||
191 | $this->validateDom($client->getResponse()->getContent(), 'tag (foo bar)', 'tags/foo-bar'); | ||
192 | |||
193 | $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml?page=3000'); | ||
194 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
195 | } | ||
171 | } | 196 | } |