diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-03-04 10:04:51 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-03-04 10:04:51 +0100 |
commit | 79d0e38e7ff975b2e0306d3dd96f57509fd84aef (patch) | |
tree | a359ef1a392865e7d41f3f927594d1480ebe1df8 /src/Wallabag/ImportBundle/Controller/PocketController.php | |
parent | c32ae320fec4135f5b32d57ef88349317a3b1f3f (diff) | |
download | wallabag-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/PocketController.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Controller/PocketController.php | 12 |
1 files changed, 5 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 |