aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2020-04-26 14:09:16 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2020-04-26 14:09:16 +0200
commitfd30989a186db2a68afa1bd24b3cf39b8ce94ef3 (patch)
treeed662cd28d46fa213da35928a35f7e0cac41d3d9
parentefea7a352f947a3632095d95a7dfbb07b8fd86c7 (diff)
downloadwallabag-fd30989a186db2a68afa1bd24b3cf39b8ce94ef3.tar.gz
wallabag-fd30989a186db2a68afa1bd24b3cf39b8ce94ef3.tar.zst
wallabag-fd30989a186db2a68afa1bd24b3cf39b8ce94ef3.zip
Enhanced tests and changed routewith-annotations-route
-rw-r--r--app/config/security.yml4
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php8
-rw-r--r--src/Wallabag/CoreBundle/Controller/ExportController.php4
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig8
-rw-r--r--src/Wallabag/CoreBundle/Twig/WallabagExtension.php2
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php6
8 files changed, 18 insertions, 18 deletions
diff --git a/app/config/security.yml b/app/config/security.yml
index 894bb83f..b06ff5cd 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -69,11 +69,11 @@ security:
69 - { path: ^/logout, roles: [IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_2FA_IN_PROGRESS] } 69 - { path: ^/logout, roles: [IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_2FA_IN_PROGRESS] }
70 - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } 70 - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
71 - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } 71 - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
72 - { path: /(unread|starred|archive|with_annotations|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } 72 - { path: /(unread|starred|archive|annotated|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
73 - { path: ^/locale, role: IS_AUTHENTICATED_ANONYMOUSLY } 73 - { path: ^/locale, role: IS_AUTHENTICATED_ANONYMOUSLY }
74 - { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } 74 - { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
75 - { path: ^/feed, roles: IS_AUTHENTICATED_ANONYMOUSLY } 75 - { path: ^/feed, roles: IS_AUTHENTICATED_ANONYMOUSLY }
76 - { path: /(unread|starred|archive|with_annotations).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } # For backwards compatibility 76 - { path: /(unread|starred|archive|annotated).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } # For backwards compatibility
77 - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY } 77 - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY }
78 - { path: ^/settings, roles: ROLE_SUPER_ADMIN } 78 - { path: ^/settings, roles: ROLE_SUPER_ADMIN }
79 - { path: ^/annotations, roles: ROLE_USER } 79 - { path: ^/annotations, roles: ROLE_USER }
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 2c4b5536..13b23b61 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -240,13 +240,13 @@ class EntryController extends Controller
240 * 240 *
241 * @param int $page 241 * @param int $page
242 * 242 *
243 * @Route("/with_annotations/list/{page}", name="with_annotations", defaults={"page" = "1"}) 243 * @Route("/annotated/list/{page}", name="annotated", defaults={"page" = "1"})
244 * 244 *
245 * @return \Symfony\Component\HttpFoundation\Response 245 * @return \Symfony\Component\HttpFoundation\Response
246 */ 246 */
247 public function showWithAnnotationsEntriesAction(Request $request, $page) 247 public function showWithAnnotationsEntriesAction(Request $request, $page)
248 { 248 {
249 return $this->showEntries('with_annotations', $request, $page); 249 return $this->showEntries('annotated', $request, $page);
250 } 250 }
251 251
252 /** 252 /**
@@ -254,7 +254,7 @@ class EntryController extends Controller
254 * 254 *
255 * @param string $type 255 * @param string $type
256 * 256 *
257 * @Route("/{type}/random", name="random_entry", requirements={"type": "unread|starred|archive|untagged|with_annotations|all"}) 257 * @Route("/{type}/random", name="random_entry", requirements={"type": "unread|starred|archive|untagged|annotated|all"})
258 * 258 *
259 * @return \Symfony\Component\HttpFoundation\RedirectResponse 259 * @return \Symfony\Component\HttpFoundation\RedirectResponse
260 */ 260 */
@@ -517,7 +517,7 @@ class EntryController extends Controller
517 case 'archive': 517 case 'archive':
518 $qb = $repository->getBuilderForArchiveByUser($this->getUser()->getId()); 518 $qb = $repository->getBuilderForArchiveByUser($this->getUser()->getId());
519 break; 519 break;
520 case 'with_annotations': 520 case 'annotated':
521 $qb = $repository->getBuilderForAnnotationsByUser($this->getUser()->getId()); 521 $qb = $repository->getBuilderForAnnotationsByUser($this->getUser()->getId());
522 break; 522 break;
523 case 'unread': 523 case 'unread':
diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php
index 8517e7a9..55b94f0a 100644
--- a/src/Wallabag/CoreBundle/Controller/ExportController.php
+++ b/src/Wallabag/CoreBundle/Controller/ExportController.php
@@ -47,7 +47,7 @@ class ExportController extends Controller
47 * 47 *
48 * @Route("/export/{category}.{format}", name="export_entries", requirements={ 48 * @Route("/export/{category}.{format}", name="export_entries", requirements={
49 * "format": "epub|mobi|pdf|json|xml|txt|csv", 49 * "format": "epub|mobi|pdf|json|xml|txt|csv",
50 * "category": "all|unread|starred|archive|tag_entries|untagged|search|with_annotations" 50 * "category": "all|unread|starred|archive|tag_entries|untagged|search|annotated"
51 * }) 51 * })
52 * 52 *
53 * @return \Symfony\Component\HttpFoundation\Response 53 * @return \Symfony\Component\HttpFoundation\Response
@@ -80,7 +80,7 @@ class ExportController extends Controller
80 ->getResult(); 80 ->getResult();
81 81
82 $title = 'Search ' . $searchTerm; 82 $title = 'Search ' . $searchTerm;
83 } elseif ('with_annotations' === $category) { 83 } elseif ('annotated' === $category) {
84 $entries = $repository->getBuilderForAnnotationsByUser( 84 $entries = $repository->getBuilderForAnnotationsByUser(
85 $this->getUser()->getId() 85 $this->getUser()->getId()
86 )->getQuery() 86 )->getQuery()
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 9f25ad4c..dab84635 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -535,7 +535,7 @@ class EntryRepository extends EntityRepository
535 $qb->leftJoin('e.tags', 't'); 535 $qb->leftJoin('e.tags', 't');
536 $qb->andWhere('t.id is null'); 536 $qb->andWhere('t.id is null');
537 break; 537 break;
538 case 'with_annotations': 538 case 'annotated':
539 $qb->leftJoin('e.annotations', 'a'); 539 $qb->leftJoin('e.annotations', 'a');
540 $qb->andWhere('a.id is not null'); 540 $qb->andWhere('a.id is not null');
541 break; 541 break;
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig
index d93e5a67..ffb070cb 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig
@@ -12,7 +12,7 @@
12 {{ 'entry.page_titles.filtered_tags'|trans }} {{ filter }} 12 {{ 'entry.page_titles.filtered_tags'|trans }} {{ filter }}
13{% elseif currentRoute == 'untagged' %} 13{% elseif currentRoute == 'untagged' %}
14 {{ 'entry.page_titles.untagged'|trans }} 14 {{ 'entry.page_titles.untagged'|trans }}
15{% elseif currentRoute == 'with_annotations' %} 15{% elseif currentRoute == 'annotated' %}
16 {{ 'entry.page_titles.with_annotations'|trans }} 16 {{ 'entry.page_titles.with_annotations'|trans }}
17{% else %} 17{% else %}
18 {{ 'entry.page_titles.unread'|trans }} 18 {{ 'entry.page_titles.unread'|trans }}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
index 6c4ae40b..e726db5a 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
@@ -40,8 +40,8 @@
40 {% set activeRoute = null %} 40 {% set activeRoute = null %}
41 {% if currentRoute == 'all' or currentRouteFromQueryParams == 'all' %} 41 {% if currentRoute == 'all' or currentRouteFromQueryParams == 'all' %}
42 {% set activeRoute = 'all' %} 42 {% set activeRoute = 'all' %}
43 {% elseif currentRoute == 'with_annotations' or currentRouteFromQueryParams == 'with_annotations' %} 43 {% elseif currentRoute == 'annotated' or currentRouteFromQueryParams == 'annotated' %}
44 {% set activeRoute = 'with_annotations' %} 44 {% set activeRoute = 'annotated' %}
45 {% elseif currentRoute == 'archive' or currentRouteFromQueryParams == 'archive' %} 45 {% elseif currentRoute == 'archive' or currentRouteFromQueryParams == 'archive' %}
46 {% set activeRoute = 'archive' %} 46 {% set activeRoute = 'archive' %}
47 {% elseif currentRoute == 'starred' or currentRouteFromQueryParams == 'starred' %} 47 {% elseif currentRoute == 'starred' or currentRouteFromQueryParams == 'starred' %}
@@ -61,8 +61,8 @@
61 <li class="bold {% if activeRoute == 'archive' %}active{% endif %}"> 61 <li class="bold {% if activeRoute == 'archive' %}active{% endif %}">
62 <a class="waves-effect" href="{{ path('archive') }}">{{ 'menu.left.archive'|trans }} <span class="numberItems grey-text">{{ count_entries('archive') }}</span></a> 62 <a class="waves-effect" href="{{ path('archive') }}">{{ 'menu.left.archive'|trans }} <span class="numberItems grey-text">{{ count_entries('archive') }}</span></a>
63 </li> 63 </li>
64 <li class="bold {% if activeRoute == 'with_annotations' %}active{% endif %}"> 64 <li class="bold {% if activeRoute == 'annotated' %}active{% endif %}">
65 <a class="waves-effect" href="{{ path('with_annotations') }}">{{ 'menu.left.with_annotations'|trans }} <span class="numberItems grey-text">{{ count_entries('with_annotations') }}</span></a> 65 <a class="waves-effect" href="{{ path('annotated') }}">{{ 'menu.left.with_annotations'|trans }} <span class="numberItems grey-text">{{ count_entries('annotated') }}</span></a>
66 </li> 66 </li>
67 <li class="bold {% if activeRoute == 'all' %}active{% endif %}"> 67 <li class="bold {% if activeRoute == 'all' %}active{% endif %}">
68 <a class="waves-effect" href="{{ path('all') }}">{{ 'menu.left.all_articles'|trans }} <span class="numberItems grey-text">{{ count_entries('all') }}</span></a> 68 <a class="waves-effect" href="{{ path('all') }}">{{ 'menu.left.all_articles'|trans }} <span class="numberItems grey-text">{{ count_entries('all') }}</span></a>
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
index e0f67375..64f54bfb 100644
--- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
+++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
@@ -94,7 +94,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
94 case 'unread': 94 case 'unread':
95 $qb = $this->entryRepository->getBuilderForUnreadByUser($user->getId()); 95 $qb = $this->entryRepository->getBuilderForUnreadByUser($user->getId());
96 break; 96 break;
97 case 'with_annotations': 97 case 'annotated':
98 $qb = $this->entryRepository->getBuilderForAnnotationsByUser($user->getId()); 98 $qb = $this->entryRepository->getBuilderForAnnotationsByUser($user->getId());
99 break; 99 break;
100 case 'all': 100 case 'all':
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 65c65ff1..07e075d4 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -404,9 +404,9 @@ class EntryControllerTest extends WallabagCoreTestCase
404 $this->logInAs('admin'); 404 $this->logInAs('admin');
405 $client = $this->getClient(); 405 $client = $this->getClient();
406 406
407 $client->request('GET', '/with_annotations/list'); 407 $crawler = $client->request('GET', '/annotated/list');
408
409 $this->assertSame(200, $client->getResponse()->getStatusCode()); 408 $this->assertSame(200, $client->getResponse()->getStatusCode());
409 $this->assertCount(2, $crawler->filter('li.entry'));
410 } 410 }
411 411
412 public function testRangeException() 412 public function testRangeException()
@@ -1563,7 +1563,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1563 $this->assertSame(302, $client->getResponse()->getStatusCode()); 1563 $this->assertSame(302, $client->getResponse()->getStatusCode());
1564 $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Untagged random'); 1564 $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Untagged random');
1565 1565
1566 $client->request('GET', '/with_annotations/random'); 1566 $client->request('GET', '/annotated/random');
1567 $this->assertSame(302, $client->getResponse()->getStatusCode()); 1567 $this->assertSame(302, $client->getResponse()->getStatusCode());
1568 $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'With annotations random'); 1568 $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'With annotations random');
1569 1569