aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-16 22:22:25 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-16 22:22:25 +0200
commitebe0787e093f4f2934430033015d6ebad1c64dca (patch)
tree0e28c1da4fdb1ee48ae021a4e63d9a8ee1ec302d
parent4fc998245c56ad95c1e753ab52b0c702d4a8a59d (diff)
downloadwallabag-ebe0787e093f4f2934430033015d6ebad1c64dca.tar.gz
wallabag-ebe0787e093f4f2934430033015d6ebad1c64dca.tar.zst
wallabag-ebe0787e093f4f2934430033015d6ebad1c64dca.zip
Moved Pocket token to user config
-rw-r--r--app/DoctrineMigrations/Version20160916201049.php44
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml31
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php5
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php3
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php5
-rw-r--r--src/Wallabag/CoreBundle/Entity/Config.php31
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ConfigType.php3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig12
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig12
-rw-r--r--src/Wallabag/ImportBundle/Controller/PocketController.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php10
-rw-r--r--src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig8
-rw-r--r--tests/Wallabag/ImportBundle/Import/PocketImportTest.php18
34 files changed, 161 insertions, 44 deletions
diff --git a/app/DoctrineMigrations/Version20160916201049.php b/app/DoctrineMigrations/Version20160916201049.php
new file mode 100644
index 00000000..ac8e6966
--- /dev/null
+++ b/app/DoctrineMigrations/Version20160916201049.php
@@ -0,0 +1,44 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9
10class Version20160916201049 extends AbstractMigration implements ContainerAwareInterface
11{
12 /**
13 * @var ContainerInterface
14 */
15 private $container;
16
17 public function setContainer(ContainerInterface $container = null)
18 {
19 $this->container = $container;
20 }
21
22 private function getTable($tableName)
23 {
24 return $this->container->getParameter('database_table_prefix') . $tableName;
25 }
26
27 /**
28 * @param Schema $schema
29 */
30 public function up(Schema $schema)
31 {
32 $this->addSql('ALTER TABLE '.$this->getTable('config').' ADD pocket_consumer_key VARCHAR(255) DEFAULT NULL');
33 }
34
35 /**
36 * @param Schema $schema
37 */
38 public function down(Schema $schema)
39 {
40 $this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
41
42 $this->addSql('ALTER TABLE `'.$this->getTable('config').'` DROP pocket_consumer_key');
43 }
44}
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml
index 905d7b2b..85079330 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml
@@ -8,7 +8,6 @@ export_csv: Aktiver eksport til CSV
8export_json: Aktiver eksport til JSON 8export_json: Aktiver eksport til JSON
9export_txt: Aktiver eksport til TXT 9export_txt: Aktiver eksport til TXT
10export_xml: Aktiver eksport til XML 10export_xml: Aktiver eksport til XML
11pocket_consumer_key: Brugers nøgle til Pocket for at importere materialer (https://getpocket.com/developer/docs/authentication)
12# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously 11# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
13# import_with_redis: Enable Redis to import data asynchronously 12# import_with_redis: Enable Redis to import data asynchronously
14shaarli_url: Shaarli-URL, hvis tjenesten er aktiv 13shaarli_url: Shaarli-URL, hvis tjenesten er aktiv
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml
index eab50ff2..eaba14cd 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml
@@ -8,7 +8,6 @@ export_csv: CSV-Export aktivieren
8export_json: JSON-Export aktivieren 8export_json: JSON-Export aktivieren
9export_txt: TXT-Export aktivieren 9export_txt: TXT-Export aktivieren
10export_xml: XML-Export aktivieren 10export_xml: XML-Export aktivieren
11pocket_consumer_key: Consumer-Key für Pocket, um Inhalte zu importieren (https://getpocket.com/developer/docs/authentication)
12# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously 11# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
13# import_with_redis: Enable Redis to import data asynchronously 12# import_with_redis: Enable Redis to import data asynchronously
14shaarli_url: Shaarli-URL, sofern der Service aktiviert ist 13shaarli_url: Shaarli-URL, sofern der Service aktiviert ist
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
index 446c9d05..8aaa27e7 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
@@ -8,7 +8,6 @@ export_csv: Enable CSV export
8export_json: Enable JSON export 8export_json: Enable JSON export
9export_txt: Enable TXT export 9export_txt: Enable TXT export
10export_xml: Enable XML export 10export_xml: Enable XML export
11pocket_consumer_key: Consumer key for Pocket to import contents (https://getpocket.com/developer/docs/authentication)
12import_with_rabbitmq: Enable RabbitMQ to import data asynchronously 11import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
13import_with_redis: Enable Redis to import data asynchronously 12import_with_redis: Enable Redis to import data asynchronously
14shaarli_url: Shaarli URL, if the service is enabled 13shaarli_url: Shaarli URL, if the service is enabled
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml
index 42f48bf7..bf3a79af 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml
@@ -8,7 +8,6 @@ export_csv: Activar exportación a CSV
8export_json: Activar exportación a JSON 8export_json: Activar exportación a JSON
9export_txt: Activar exportación a TXT 9export_txt: Activar exportación a TXT
10export_xml: Activar exportación a XML 10export_xml: Activar exportación a XML
11pocket_consumer_key: Consumer key for Pocket to import contents (https://getpocket.com/developer/docs/authentication)
12# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously 11# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
13# import_with_redis: Enable Redis to import data asynchronously 12# import_with_redis: Enable Redis to import data asynchronously
14shaarli_url: Shaarli URL, si el servicio está activado 13shaarli_url: Shaarli URL, si el servicio está activado
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml
index 6fc17c98..d86c4343 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml
@@ -8,7 +8,6 @@ export_csv: فعال‌سازی برون‌سپاری به CSV
8export_json: فعال‌سازی برون‌سپاری به JSON 8export_json: فعال‌سازی برون‌سپاری به JSON
9export_txt: فعال‌سازی برون‌سپاری به TXT 9export_txt: فعال‌سازی برون‌سپاری به TXT
10export_xml: فعال‌سازی برون‌سپاری به XML 10export_xml: فعال‌سازی برون‌سپاری به XML
11pocket_consumer_key: کلید کاربری Pocket برای درون‌ریزی مطالب (https://getpocket.com/developer/docs/authentication)
12# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously 11# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
13# import_with_redis: Enable Redis to import data asynchronously 12# import_with_redis: Enable Redis to import data asynchronously
14shaarli_url: نشانی Shaarli، اگر فعال بود 13shaarli_url: نشانی Shaarli، اگر فعال بود
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
index 08351b77..5e1ecf26 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
@@ -8,7 +8,6 @@ export_csv: Activer l'export CSV
8export_json: Activer l'export JSON 8export_json: Activer l'export JSON
9export_txt: Activer l'export TXT 9export_txt: Activer l'export TXT
10export_xml: Activer l'export XML 10export_xml: Activer l'export XML
11pocket_consumer_key: Clé d'authentification Pocket pour importer les données (https://getpocket.com/developer/docs/authentication)
12import_with_rabbitmq: Activer RabbitMQ pour gérer les imports de façon asynchrone 11import_with_rabbitmq: Activer RabbitMQ pour gérer les imports de façon asynchrone
13import_with_redis: Activer Redis pour gérer les imports de façon asynchrone 12import_with_redis: Activer Redis pour gérer les imports de façon asynchrone
14shaarli_url: URL de Shaarli, si le service Shaarli est activé 13shaarli_url: URL de Shaarli, si le service Shaarli est activé
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml
index 0c8a906d..9d820e4b 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml
@@ -8,7 +8,6 @@ export_csv: Abilita esportazione CSV
8export_json: Abilita esportazione JSON 8export_json: Abilita esportazione JSON
9export_txt: Abilita esportazione TXT 9export_txt: Abilita esportazione TXT
10export_xml: Abilita esportazione XML 10export_xml: Abilita esportazione XML
11pocket_consumer_key: Consumer key per Pocket per importare i contenuti (https://getpocket.com/developer/docs/authentication)
12# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously 11# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
13# import_with_redis: Enable Redis to import data asynchronously 12# import_with_redis: Enable Redis to import data asynchronously
14shaarli_url: Shaarli URL, se il servizio è abilitato 13shaarli_url: Shaarli URL, se il servizio è abilitato
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml
index f578095e..49dc7732 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml
@@ -8,7 +8,6 @@ export_csv: Activar l'expòrt CSV
8export_json: Activar l'expòrt JSON 8export_json: Activar l'expòrt JSON
9export_txt: Activar l'expòrt TXT 9export_txt: Activar l'expòrt TXT
10export_xml: Activar l'expòrt XML 10export_xml: Activar l'expòrt XML
11pocket_consumer_key: Clau d'autentificacion Pocket per importar las donadas (https://getpocket.com/developer/docs/authentication)
12# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously 11# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
13# import_with_redis: Enable Redis to import data asynchronously 12# import_with_redis: Enable Redis to import data asynchronously
14shaarli_url: URL de Shaarli, se lo servici Shaarli es activat 13shaarli_url: URL de Shaarli, se lo servici Shaarli es activat
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml
index 351ee2a8..2365f2b3 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml
@@ -8,7 +8,6 @@ export_csv: Włącz eksport do CSV
8export_json: Włącz eksport do JSON 8export_json: Włącz eksport do JSON
9export_txt: Włącz eksport do TXT 9export_txt: Włącz eksport do TXT
10export_xml: Włącz eksport do XML 10export_xml: Włącz eksport do XML
11pocket_consumer_key: Klucz klienta Pocket do importu zawartości (https://getpocket.com/developer/docs/authentication)
12# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously 11# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
13# import_with_redis: Enable Redis to import data asynchronously 12# import_with_redis: Enable Redis to import data asynchronously
14shaarli_url: Adress URL Shaarli, jeżeli usługa jest włączona 13shaarli_url: Adress URL Shaarli, jeżeli usługa jest włączona
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml
index b9b41ee7..20d664f7 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml
@@ -8,7 +8,6 @@ export_csv: Permite exportare CSV
8export_json: Permite exportare JSON 8export_json: Permite exportare JSON
9export_txt: Permite exportare TXT 9export_txt: Permite exportare TXT
10export_xml: Permite exportare XML 10export_xml: Permite exportare XML
11pocket_consumer_key: Cheie consumator pentru importarea contentului din Pocket (https://getpocket.com/developer/docs/authentication)
12# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously 11# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
13# import_with_redis: Enable Redis to import data asynchronously 12# import_with_redis: Enable Redis to import data asynchronously
14shaarli_url: Shaarli URL, dacă serviciul este permis 13shaarli_url: Shaarli URL, dacă serviciul este permis
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml
new file mode 100644
index 00000000..4b4d3edb
--- /dev/null
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml
@@ -0,0 +1,31 @@
1# download_pictures: Download pictures on your server
2# carrot: Enable share to Carrot
3# diaspora_url: Diaspora URL, if the service is enabled
4# export_epub: Enable ePub export
5# export_mobi: Enable .mobi export
6# export_pdf: Enable PDF export
7# export_csv: Enable CSV export
8# export_json: Enable JSON export
9# export_txt: Enable TXT export
10# export_xml: Enable XML export
11# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
12# import_with_redis: Enable Redis to import data asynchronously
13# shaarli_url: Shaarli URL, if the service is enabled
14# share_diaspora: Enable share to Diaspora
15# share_mail: Enable share by email
16# share_shaarli: Enable share to Shaarli
17# share_twitter: Enable share to Twitter
18# show_printlink: Display a link to print content
19# wallabag_support_url: Support URL for wallabag
20# wallabag_url: URL of *your* wallabag instance
21# entry: "article"
22# export: "export"
23# import: "import"
24# misc: "misc"
25# modify_settings: "apply"
26# piwik_host: Host of your website in Piwik
27# piwik_site_id: ID of your website in Piwik
28# piwik_enabled: Enable Piwik
29# demo_mode_enabled: "Enable demo mode ? (only used for the wallabag public demo)"
30# demo_mode_username: "Demo user"
31# share_public: Allow public url for entries
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 4b1ec02a..bd7b55f9 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -317,11 +317,6 @@ class InstallCommand extends ContainerAwareCommand
317 'section' => 'export', 317 'section' => 'export',
318 ], 318 ],
319 [ 319 [
320 'name' => 'pocket_consumer_key',
321 'value' => null,
322 'section' => 'import',
323 ],
324 [
325 'name' => 'import_with_redis', 320 'name' => 'import_with_redis',
326 'value' => '0', 321 'value' => '0',
327 'section' => 'import', 322 'section' => 'import',
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
index 03be9667..921c739f 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
@@ -20,6 +20,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
20 $adminConfig->setItemsPerPage(30); 20 $adminConfig->setItemsPerPage(30);
21 $adminConfig->setReadingSpeed(1); 21 $adminConfig->setReadingSpeed(1);
22 $adminConfig->setLanguage('en'); 22 $adminConfig->setLanguage('en');
23 $adminConfig->setPocketConsumerKey('xxxxx');
23 24
24 $manager->persist($adminConfig); 25 $manager->persist($adminConfig);
25 26
@@ -30,6 +31,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
30 $bobConfig->setItemsPerPage(10); 31 $bobConfig->setItemsPerPage(10);
31 $bobConfig->setReadingSpeed(1); 32 $bobConfig->setReadingSpeed(1);
32 $bobConfig->setLanguage('fr'); 33 $bobConfig->setLanguage('fr');
34 $bobConfig->setPocketConsumerKey(null);
33 35
34 $manager->persist($bobConfig); 36 $manager->persist($bobConfig);
35 37
@@ -40,6 +42,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
40 $emptyConfig->setItemsPerPage(10); 42 $emptyConfig->setItemsPerPage(10);
41 $emptyConfig->setReadingSpeed(1); 43 $emptyConfig->setReadingSpeed(1);
42 $emptyConfig->setLanguage('en'); 44 $emptyConfig->setLanguage('en');
45 $emptyConfig->setPocketConsumerKey(null);
43 46
44 $manager->persist($emptyConfig); 47 $manager->persist($emptyConfig);
45 48
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
index 3ed6bafe..9425f961 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
@@ -91,11 +91,6 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
91 'section' => 'export', 91 'section' => 'export',
92 ], 92 ],
93 [ 93 [
94 'name' => 'pocket_consumer_key',
95 'value' => null,
96 'section' => 'import',
97 ],
98 [
99 'name' => 'import_with_redis', 94 'name' => 'import_with_redis',
100 'value' => '0', 95 'value' => '0',
101 'section' => 'import', 96 'section' => 'import',
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php
index a25656d3..d0f0e3f3 100644
--- a/src/Wallabag/CoreBundle/Entity/Config.php
+++ b/src/Wallabag/CoreBundle/Entity/Config.php
@@ -81,6 +81,13 @@ class Config
81 private $readingSpeed; 81 private $readingSpeed;
82 82
83 /** 83 /**
84 * @var string
85 *
86 * @ORM\Column(name="pocket_consumer_key", type="string", nullable=true)
87 */
88 private $pocketConsumerKey;
89
90 /**
84 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config") 91 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
85 */ 92 */
86 private $user; 93 private $user;
@@ -279,6 +286,30 @@ class Config
279 } 286 }
280 287
281 /** 288 /**
289 * Set pocketConsumerKey.
290 *
291 * @param string $pocketConsumerKey
292 *
293 * @return Config
294 */
295 public function setPocketConsumerKey($pocketConsumerKey)
296 {
297 $this->pocketConsumerKey = $pocketConsumerKey;
298
299 return $this;
300 }
301
302 /**
303 * Get pocketConsumerKey.
304 *
305 * @return string
306 */
307 public function getPocketConsumerKey()
308 {
309 return $this->pocketConsumerKey;
310 }
311
312 /**
282 * @param TaggingRule $rule 313 * @param TaggingRule $rule
283 * 314 *
284 * @return Config 315 * @return Config
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
index 7d25cc80..0bac2874 100644
--- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
@@ -52,6 +52,9 @@ class ConfigType extends AbstractType
52 'choices' => array_flip($this->languages), 52 'choices' => array_flip($this->languages),
53 'label' => 'config.form_settings.language_label', 53 'label' => 'config.form_settings.language_label',
54 ]) 54 ])
55 ->add('pocket_consumer_key', null, [
56 'label' => 'config.form_settings.pocket_consumer_key_label',
57 ])
55 ->add('save', SubmitType::class, [ 58 ->add('save', SubmitType::class, [
56 'label' => 'config.form.save', 59 'label' => 'config.form.save',
57 ]) 60 ])
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index 4e5ed9ae..0a7c6e8c 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -68,6 +68,7 @@ config:
68 # 200_word: 'I read ~200 words per minute' 68 # 200_word: 'I read ~200 words per minute'
69 # 300_word: 'I read ~300 words per minute' 69 # 300_word: 'I read ~300 words per minute'
70 # 400_word: 'I read ~400 words per minute' 70 # 400_word: 'I read ~400 words per minute'
71 pocket_consumer_key_label: Brugers nøgle til Pocket for at importere materialer
71 form_rss: 72 form_rss:
72 description: 'RSS-feeds fra wallabag gør det muligt at læse de artikler, der gemmes i wallabag, med din RSS-læser. Det kræver, at du genererer et token først.' 73 description: 'RSS-feeds fra wallabag gør det muligt at læse de artikler, der gemmes i wallabag, med din RSS-læser. Det kræver, at du genererer et token først.'
73 token_label: 'RSS-Token' 74 token_label: 'RSS-Token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 107187bf..a400686e 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'Ich lese ~200 Wörter pro Minute' 68 200_word: 'Ich lese ~200 Wörter pro Minute'
69 300_word: 'Ich lese ~300 Wörter pro Minute' 69 300_word: 'Ich lese ~300 Wörter pro Minute'
70 400_word: 'Ich lese ~400 Wörter pro Minute' 70 400_word: 'Ich lese ~400 Wörter pro Minute'
71 pocket_consumer_key_label: Consumer-Key für Pocket, um Inhalte zu importieren
71 form_rss: 72 form_rss:
72 description: 'Die RSS-Feeds von wallabag erlauben es dir, deine gespeicherten Artikel mit deinem bevorzugten RSS-Reader zu lesen. Vorher musst du jedoch einen Token erstellen.' 73 description: 'Die RSS-Feeds von wallabag erlauben es dir, deine gespeicherten Artikel mit deinem bevorzugten RSS-Reader zu lesen. Vorher musst du jedoch einen Token erstellen.'
73 token_label: 'RSS-token' 74 token_label: 'RSS-token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index ac60295f..2d097caf 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'I read ~200 words per minute' 68 200_word: 'I read ~200 words per minute'
69 300_word: 'I read ~300 words per minute' 69 300_word: 'I read ~300 words per minute'
70 400_word: 'I read ~400 words per minute' 70 400_word: 'I read ~400 words per minute'
71 pocket_consumer_key_label: Consumer key for Pocket to import contents
71 form_rss: 72 form_rss:
72 description: 'RSS feeds provided by wallabag allow you to read your saved articles with your favourite RSS reader. You need to generate a token first.' 73 description: 'RSS feeds provided by wallabag allow you to read your saved articles with your favourite RSS reader. You need to generate a token first.'
73 token_label: 'RSS token' 74 token_label: 'RSS token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 1082e6de..1dbff022 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'Leo ~200 palabras por minuto' 68 200_word: 'Leo ~200 palabras por minuto'
69 300_word: 'Leo ~300 palabras por minuto' 69 300_word: 'Leo ~300 palabras por minuto'
70 400_word: 'Leo ~400 palabras por minuto' 70 400_word: 'Leo ~400 palabras por minuto'
71 # pocket_consumer_key_label: Consumer key for Pocket to import contents
71 form_rss: 72 form_rss:
72 description: 'Los feeds RSS de wallabag permiten leer los artículos guardados con su lector RSS favorito. Necesita generar un token primero' 73 description: 'Los feeds RSS de wallabag permiten leer los artículos guardados con su lector RSS favorito. Necesita generar un token primero'
73 token_label: 'RSS token' 74 token_label: 'RSS token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index 78317a9c..ad13c940 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'من تقریباً ۲۰۰ واژه را در دقیقه می‌خوانم' 68 200_word: 'من تقریباً ۲۰۰ واژه را در دقیقه می‌خوانم'
69 300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه می‌خوانم' 69 300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه می‌خوانم'
70 400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه می‌خوانم' 70 400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه می‌خوانم'
71 pocket_consumer_key_label: کلید کاربری Pocket برای درون‌ریزی مطالب
71 form_rss: 72 form_rss:
72 description: 'با خوراک آر-اس-اس که wallabag در اختیارتان می‌گذارد، می‌توانید مقاله‌های ذخیره‌شده را در نرم‌افزار آر-اس-اس دلخواه خود بخوانید. برای این کار نخست باید یک کد بسازید.' 73 description: 'با خوراک آر-اس-اس که wallabag در اختیارتان می‌گذارد، می‌توانید مقاله‌های ذخیره‌شده را در نرم‌افزار آر-اس-اس دلخواه خود بخوانید. برای این کار نخست باید یک کد بسازید.'
73 token_label: 'کد آر-اس-اس' 74 token_label: 'کد آر-اس-اس'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 50515d80..35e5c9d0 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'Je lis environ 200 mots par minute' 68 200_word: 'Je lis environ 200 mots par minute'
69 300_word: 'Je lis environ 300 mots par minute' 69 300_word: 'Je lis environ 300 mots par minute'
70 400_word: 'Je lis environ 400 mots par minute' 70 400_word: 'Je lis environ 400 mots par minute'
71 pocket_consumer_key_label: Clé d'authentification Pocket pour importer les données
71 form_rss: 72 form_rss:
72 description: "Les flux RSS fournis par wallabag vous permettent de lire vos articles sauvegardés dans votre lecteur de flux préféré. Pour pouvoir les utiliser, vous devez d'abord créer un jeton." 73 description: "Les flux RSS fournis par wallabag vous permettent de lire vos articles sauvegardés dans votre lecteur de flux préféré. Pour pouvoir les utiliser, vous devez d'abord créer un jeton."
73 token_label: 'Jeton RSS' 74 token_label: 'Jeton RSS'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 5badeffc..5bc896c3 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'Leggo ~200 parole al minuto' 68 200_word: 'Leggo ~200 parole al minuto'
69 300_word: 'Leggo ~300 parole al minuto' 69 300_word: 'Leggo ~300 parole al minuto'
70 400_word: 'Leggo ~400 parole al minuto' 70 400_word: 'Leggo ~400 parole al minuto'
71 pocket_consumer_key_label: Consumer key per Pocket per importare i contenuti
71 form_rss: 72 form_rss:
72 description: 'I feed RSS generati da wallabag ti permettono di leggere i tuoi contenuti salvati con il tuo lettore di RSS preferito. Prima, devi generare un token.' 73 description: 'I feed RSS generati da wallabag ti permettono di leggere i tuoi contenuti salvati con il tuo lettore di RSS preferito. Prima, devi generare un token.'
73 token_label: 'RSS token' 74 token_label: 'RSS token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 2383886c..b0194c59 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -68,6 +68,7 @@ config:
68 200_word: "Legissi a l'entorn de 200 mots per minuta" 68 200_word: "Legissi a l'entorn de 200 mots per minuta"
69 300_word: "Legissi a l'entorn de 300 mots per minuta" 69 300_word: "Legissi a l'entorn de 300 mots per minuta"
70 400_word: "Legissi a l'entorn de 400 mots per minuta" 70 400_word: "Legissi a l'entorn de 400 mots per minuta"
71 pocket_consumer_key_label: Clau d'autentificacion Pocket per importar las donadas
71 form_rss: 72 form_rss:
72 description: "Los fluxes RSS fornits per wallabag vos permeton de legir vòstres articles salvagardats dins vòstre lector de fluxes preferit. Per los poder emplegar, vos cal, d'en primièr crear un geton." 73 description: "Los fluxes RSS fornits per wallabag vos permeton de legir vòstres articles salvagardats dins vòstre lector de fluxes preferit. Per los poder emplegar, vos cal, d'en primièr crear un geton."
73 token_label: 'Geton RSS' 74 token_label: 'Geton RSS'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index 40cd2b71..6412ad16 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'Czytam ~200 słów na minutę' 68 200_word: 'Czytam ~200 słów na minutę'
69 300_word: 'Czytam ~300 słów na minutę' 69 300_word: 'Czytam ~300 słów na minutę'
70 400_word: 'Czytam ~400 słów na minutę' 70 400_word: 'Czytam ~400 słów na minutę'
71 pocket_consumer_key_label: Klucz klienta Pocket do importu zawartości
71 form_rss: 72 form_rss:
72 description: 'Kanały RSS prowadzone przez wallabag pozwalają Ci na czytanie twoich zapisanych artykułów w twoium ulubionym czytniku RSS. Musisz najpierw wynegenerować tokena.‌' 73 description: 'Kanały RSS prowadzone przez wallabag pozwalają Ci na czytanie twoich zapisanych artykułów w twoium ulubionym czytniku RSS. Musisz najpierw wynegenerować tokena.‌'
73 token_label: 'Token RSS' 74 token_label: 'Token RSS'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index b18eab9e..11b744c7 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -68,6 +68,7 @@ config:
68 # 200_word: 'I read ~200 words per minute' 68 # 200_word: 'I read ~200 words per minute'
69 # 300_word: 'I read ~300 words per minute' 69 # 300_word: 'I read ~300 words per minute'
70 # 400_word: 'I read ~400 words per minute' 70 # 400_word: 'I read ~400 words per minute'
71 pocket_consumer_key_label: Cheie consumator pentru importarea contentului din Pocket
71 form_rss: 72 form_rss:
72 description: 'Feed-urile RSS oferite de wallabag îți permit să-ți citești articolele salvate în reader-ul tău preferat RSS.' 73 description: 'Feed-urile RSS oferite de wallabag îți permit să-ți citești articolele salvate în reader-ul tău preferat RSS.'
73 token_label: 'RSS-Token' 74 token_label: 'RSS-Token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 82fa93af..d6aaacfe 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -68,6 +68,7 @@ config:
68 # 200_word: 'I read ~200 words per minute' 68 # 200_word: 'I read ~200 words per minute'
69 # 300_word: 'I read ~300 words per minute' 69 # 300_word: 'I read ~300 words per minute'
70 # 400_word: 'I read ~400 words per minute' 70 # 400_word: 'I read ~400 words per minute'
71 # pocket_consumer_key_label: Consumer key for Pocket to import contents
71 form_rss: 72 form_rss:
72 description: 'wallabag RSS akışı kaydetmiş olduğunuz makalelerini favori RSS okuyucunuzda görüntülemenizi sağlar. Bunu yapabilmek için öncelikle belirteç (token) oluşturmalısınız.' 73 description: 'wallabag RSS akışı kaydetmiş olduğunuz makalelerini favori RSS okuyucunuzda görüntülemenizi sağlar. Bunu yapabilmek için öncelikle belirteç (token) oluşturmalısınız.'
73 token_label: 'RSS belirteci (token)' 74 token_label: 'RSS belirteci (token)'
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 f89265d4..6446cf2c 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
@@ -44,6 +44,18 @@
44 </div> 44 </div>
45 </fieldset> 45 </fieldset>
46 46
47 <fieldset class="w500p inline">
48 <div class="row">
49 {{ form_label(form.config.pocket_consumer_key) }}
50 {{ form_errors(form.config.pocket_consumer_key) }}
51 {{ form_widget(form.config.pocket_consumer_key) }}
52 <p>
53 &raquo;
54 <a href="https://getpocket.com/developer/docs/authentication">https://getpocket.com/developer/docs/authentication</a>
55 </p>
56 </div>
57 </fieldset>
58
47 {{ form_rest(form.config) }} 59 {{ form_rest(form.config) }}
48 </form> 60 </form>
49 61
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 bf390e89..5330c353 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
@@ -62,6 +62,18 @@
62 </div> 62 </div>
63 </div> 63 </div>
64 64
65 <div class="row">
66 <div class="input-field col s12">
67 {{ form_label(form.config.pocket_consumer_key) }}
68 {{ form_errors(form.config.pocket_consumer_key) }}
69 {{ form_widget(form.config.pocket_consumer_key) }}
70 <p>
71 &raquo;
72 <a href="https://getpocket.com/developer/docs/authentication">https://getpocket.com/developer/docs/authentication</a>
73 </p>
74 </div>
75 </div>
76
65 {{ form_widget(form.config.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }} 77 {{ form_widget(form.config.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
66 {{ form_rest(form.config) }} 78 {{ form_rest(form.config) }}
67 </form> 79 </form>
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php
index 1f92c182..56be5cbf 100644
--- a/src/Wallabag/ImportBundle/Controller/PocketController.php
+++ b/src/Wallabag/ImportBundle/Controller/PocketController.php
@@ -44,7 +44,7 @@ class PocketController extends Controller
44 44
45 return $this->render('WallabagImportBundle:Pocket:index.html.twig', [ 45 return $this->render('WallabagImportBundle:Pocket:index.html.twig', [
46 'import' => $this->getPocketImportService(), 46 'import' => $this->getPocketImportService(),
47 'has_consumer_key' => '' == trim($this->get('craue_config')->get('pocket_consumer_key')) ? false : true, 47 'has_consumer_key' => '' === trim($this->getUser()->getConfig()->getPocketConsumerKey()) ? false : true,
48 'form' => $form->createView(), 48 'form' => $form->createView(),
49 ]); 49 ]);
50 } 50 }
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index cc6faf1f..40603c90 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -13,16 +13,14 @@ use Craue\ConfigBundle\Util\Config;
13class PocketImport extends AbstractImport 13class PocketImport extends AbstractImport
14{ 14{
15 private $client; 15 private $client;
16 private $consumerKey;
17 private $accessToken; 16 private $accessToken;
18 17
19 const NB_ELEMENTS = 5000; 18 const NB_ELEMENTS = 5000;
20 19
21 public function __construct(EntityManager $em, ContentProxy $contentProxy, Config $craueConfig) 20 public function __construct(EntityManager $em, ContentProxy $contentProxy)
22 { 21 {
23 $this->em = $em; 22 $this->em = $em;
24 $this->contentProxy = $contentProxy; 23 $this->contentProxy = $contentProxy;
25 $this->consumerKey = $craueConfig->get('pocket_consumer_key');
26 $this->logger = new NullLogger(); 24 $this->logger = new NullLogger();
27 } 25 }
28 26
@@ -72,7 +70,7 @@ class PocketImport extends AbstractImport
72 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/request', 70 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/request',
73 [ 71 [
74 'body' => json_encode([ 72 'body' => json_encode([
75 'consumer_key' => $this->consumerKey, 73 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
76 'redirect_uri' => $redirectUri, 74 'redirect_uri' => $redirectUri,
77 ]), 75 ]),
78 ] 76 ]
@@ -102,7 +100,7 @@ class PocketImport extends AbstractImport
102 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/authorize', 100 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/authorize',
103 [ 101 [
104 'body' => json_encode([ 102 'body' => json_encode([
105 'consumer_key' => $this->consumerKey, 103 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
106 'code' => $code, 104 'code' => $code,
107 ]), 105 ]),
108 ] 106 ]
@@ -131,7 +129,7 @@ class PocketImport extends AbstractImport
131 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/get', 129 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/get',
132 [ 130 [
133 'body' => json_encode([ 131 'body' => json_encode([
134 'consumer_key' => $this->consumerKey, 132 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
135 'access_token' => $this->accessToken, 133 'access_token' => $this->accessToken,
136 'detailType' => 'complete', 134 'detailType' => 'complete',
137 'state' => 'all', 135 'state' => 'all',
diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
index aa5941b7..6195fa07 100644
--- a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
+++ b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
@@ -12,11 +12,7 @@
12 <div class="card-panel red white-text"> 12 <div class="card-panel red white-text">
13 {{ 'import.pocket.config_missing.description'|trans }} 13 {{ 'import.pocket.config_missing.description'|trans }}
14 14
15 {% if is_granted('ROLE_SUPER_ADMIN') %} 15 {{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('config') ~ '">', '%keyurle%':'</a>'})|raw }}
16 {{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('craue_config_settings_modify') ~ '#set-import">', '%keyurle%':'</a>'})|raw }}
17 {% else %}
18 {{ 'import.pocket.config_missing.user_message'|trans }}
19 {% endif %}
20 </div> 16 </div>
21 {% endif %} 17 {% endif %}
22 18
@@ -31,7 +27,7 @@
31 {{ form_label(form.mark_as_read) }} 27 {{ form_label(form.mark_as_read) }}
32 </div> 28 </div>
33 </div> 29 </div>
34 <button class="btn waves-effect waves-light" type="submit" name="action"> 30 <button class="btn waves-effect waves-light" type="submit" name="action" {% if not has_consumer_key %}disabled="disabled"{% endif %}>
35 {{ 'import.pocket.connect_to_pocket'|trans }} 31 {{ 'import.pocket.connect_to_pocket'|trans }}
36 </button> 32 </button>
37 </form> 33 </form>
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
index a3f68892..48fbbfb6 100644
--- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
@@ -4,6 +4,7 @@ namespace Tests\Wallabag\ImportBundle\Import;
4 4
5use Wallabag\UserBundle\Entity\User; 5use Wallabag\UserBundle\Entity\User;
6use Wallabag\CoreBundle\Entity\Entry; 6use Wallabag\CoreBundle\Entity\Entry;
7use Wallabag\CoreBundle\Entity\Config;
7use Wallabag\ImportBundle\Import\PocketImport; 8use Wallabag\ImportBundle\Import\PocketImport;
8use GuzzleHttp\Client; 9use GuzzleHttp\Client;
9use GuzzleHttp\Subscriber\Mock; 10use GuzzleHttp\Subscriber\Mock;
@@ -27,6 +28,11 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
27 { 28 {
28 $this->user = new User(); 29 $this->user = new User();
29 30
31 $config = new Config($this->user);
32 $config->setPocketConsumerKey('xxx');
33
34 $this->user->setConfig($config);
35
30 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') 36 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
31 ->disableOriginalConstructor() 37 ->disableOriginalConstructor()
32 ->getMock(); 38 ->getMock();
@@ -35,19 +41,9 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
35 ->disableOriginalConstructor() 41 ->disableOriginalConstructor()
36 ->getMock(); 42 ->getMock();
37 43
38 $config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config')
39 ->disableOriginalConstructor()
40 ->getMock();
41
42 $config->expects($this->any())
43 ->method('get')
44 ->with('pocket_consumer_key')
45 ->willReturn($consumerKey);
46
47 $pocket = new PocketImport( 44 $pocket = new PocketImport(
48 $this->em, 45 $this->em,
49 $this->contentProxy, 46 $this->contentProxy
50 $config
51 ); 47 );
52 $pocket->setUser($this->user); 48 $pocket->setUser($this->user);
53 49