1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-12 16:58:37 +00:00

Adding test

Reformat json file (thanks pro.jsonlint.com)
This commit is contained in:
Jeremy Benoist 2016-03-04 10:04:51 +01:00
parent c32ae320fe
commit 79d0e38e7f
10 changed files with 219 additions and 63 deletions

View file

@ -18,9 +18,9 @@ class PocketController extends Controller
$pocket = $this->get('wallabag_import.pocket.import');
$form = $this->createFormBuilder($pocket)
->add('read', CheckboxType::class, array(
'label' => 'Mark all as read',
'required' => false,
))
'label' => 'Mark all as read',
'required' => false,
))
->getForm();
return $this->render('WallabagImportBundle:Pocket:index.html.twig', [
@ -39,8 +39,7 @@ class PocketController extends Controller
->getRequestToken($this->generateUrl('import', array(), UrlGeneratorInterface::ABSOLUTE_URL));
$this->get('session')->set('import.pocket.code', $requestToken);
$markAsRead = $request->request->get('form')['read'];
$this->get('session')->set('read', $markAsRead);
$this->get('session')->set('read', $request->request->get('form')['read']);
return $this->redirect(
'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
$message = 'Import failed, please try again.';
$pocket = $this->get('wallabag_import.pocket.import');
$markAsRead = $this->get('session')->get('read');
$this->get('session')->remove('read');
// something bad happend on pocket side
if (false === $pocket->authorize($this->get('session')->get('import.pocket.code'))) {
@ -72,8 +72,6 @@ class PocketController extends Controller
$message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.';
}
$this->get('session')->remove('read');
$this->get('session')->getFlashBag()->add(
'notice',
$message