aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Controller
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-03-04 10:04:51 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-03-04 10:04:51 +0100
commit79d0e38e7ff975b2e0306d3dd96f57509fd84aef (patch)
treea359ef1a392865e7d41f3f927594d1480ebe1df8 /src/Wallabag/ImportBundle/Controller
parentc32ae320fec4135f5b32d57ef88349317a3b1f3f (diff)
downloadwallabag-79d0e38e7ff975b2e0306d3dd96f57509fd84aef.tar.gz
wallabag-79d0e38e7ff975b2e0306d3dd96f57509fd84aef.tar.zst
wallabag-79d0e38e7ff975b2e0306d3dd96f57509fd84aef.zip
Adding test
Reformat json file (thanks pro.jsonlint.com)
Diffstat (limited to 'src/Wallabag/ImportBundle/Controller')
-rw-r--r--src/Wallabag/ImportBundle/Controller/PocketController.php12
-rw-r--r--src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php1
2 files changed, 6 insertions, 7 deletions
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php
index ef0407e6..c88e115e 100644
--- a/src/Wallabag/ImportBundle/Controller/PocketController.php
+++ b/src/Wallabag/ImportBundle/Controller/PocketController.php
@@ -18,9 +18,9 @@ class PocketController extends Controller
18 $pocket = $this->get('wallabag_import.pocket.import'); 18 $pocket = $this->get('wallabag_import.pocket.import');
19 $form = $this->createFormBuilder($pocket) 19 $form = $this->createFormBuilder($pocket)
20 ->add('read', CheckboxType::class, array( 20 ->add('read', CheckboxType::class, array(
21 'label' => 'Mark all as read', 21 'label' => 'Mark all as read',
22 'required' => false, 22 'required' => false,
23 )) 23 ))
24 ->getForm(); 24 ->getForm();
25 25
26 return $this->render('WallabagImportBundle:Pocket:index.html.twig', [ 26 return $this->render('WallabagImportBundle:Pocket:index.html.twig', [
@@ -39,8 +39,7 @@ class PocketController extends Controller
39 ->getRequestToken($this->generateUrl('import', array(), UrlGeneratorInterface::ABSOLUTE_URL)); 39 ->getRequestToken($this->generateUrl('import', array(), UrlGeneratorInterface::ABSOLUTE_URL));
40 40
41 $this->get('session')->set('import.pocket.code', $requestToken); 41 $this->get('session')->set('import.pocket.code', $requestToken);
42 $markAsRead = $request->request->get('form')['read']; 42 $this->get('session')->set('read', $request->request->get('form')['read']);
43 $this->get('session')->set('read', $markAsRead);
44 43
45 return $this->redirect( 44 return $this->redirect(
46 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL), 45 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL),
@@ -56,6 +55,7 @@ class PocketController extends Controller
56 $message = 'Import failed, please try again.'; 55 $message = 'Import failed, please try again.';
57 $pocket = $this->get('wallabag_import.pocket.import'); 56 $pocket = $this->get('wallabag_import.pocket.import');
58 $markAsRead = $this->get('session')->get('read'); 57 $markAsRead = $this->get('session')->get('read');
58 $this->get('session')->remove('read');
59 59
60 // something bad happend on pocket side 60 // something bad happend on pocket side
61 if (false === $pocket->authorize($this->get('session')->get('import.pocket.code'))) { 61 if (false === $pocket->authorize($this->get('session')->get('import.pocket.code'))) {
@@ -72,8 +72,6 @@ class PocketController extends Controller
72 $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; 72 $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.';
73 } 73 }
74 74
75 $this->get('session')->remove('read');
76
77 $this->get('session')->getFlashBag()->add( 75 $this->get('session')->getFlashBag()->add(
78 'notice', 76 'notice',
79 $message 77 $message
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php
index 8b27144b..154a0769 100644
--- a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php
+++ b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php
@@ -32,6 +32,7 @@ class WallabagV1Controller extends Controller
32 ->import(); 32 ->import();
33 33
34 $message = 'Import failed, please try again.'; 34 $message = 'Import failed, please try again.';
35
35 if (true === $res) { 36 if (true === $res) {
36 $summary = $wallabag->getSummary(); 37 $summary = $wallabag->getSummary();
37 $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; 38 $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.';