Merge remote-tracking branch 'origin/master' into 2.3

This commit is contained in:
Jeremy Benoist 2017-05-19 11:25:19 +02:00
commit 4ab0d25f65
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
23 changed files with 727 additions and 604 deletions

File diff suppressed because it is too large Load diff

View file

@ -35,7 +35,7 @@ framework:
assets: ~ assets: ~
wallabag_core: wallabag_core:
version: 2.2.2 version: 2.2.3
paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb" paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb"
languages: languages:
en: 'English' en: 'English'

View file

@ -84,7 +84,7 @@
"javibravo/simpleue": "^1.0", "javibravo/simpleue": "^1.0",
"symfony/dom-crawler": "^3.1", "symfony/dom-crawler": "^3.1",
"friendsofsymfony/jsrouting-bundle": "^1.6", "friendsofsymfony/jsrouting-bundle": "^1.6",
"bdunogier/guzzle-site-authenticator": "dev-master" "bdunogier/guzzle-site-authenticator": "1.0.0-beta1"
}, },
"require-dev": { "require-dev": {
"doctrine/doctrine-fixtures-bundle": "~2.2", "doctrine/doctrine-fixtures-bundle": "~2.2",

View file

@ -297,10 +297,19 @@ class EntryRestController extends WallabagRestController
$entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId()); $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId());
if (false === $entry) { if (false === $entry) {
$entry = $this->get('wallabag_core.content_proxy')->updateEntry( $entry = new Entry($this->getUser());
new Entry($this->getUser()), try {
$url $entry = $this->get('wallabag_core.content_proxy')->updateEntry(
); $entry,
$url
);
} catch (\Exception $e) {
$this->get('logger')->error('Error while saving an entry', [
'exception' => $e,
'entry' => $entry,
]);
$entry->setUrl($url);
}
} }
if (!is_null($title)) { if (!is_null($title)) {

View file

@ -3,6 +3,7 @@
namespace Wallabag\CoreBundle\Form\Type; namespace Wallabag\CoreBundle\Form\Type;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Lexik\Bundle\FormFilterBundle\Filter\FilterOperands;
use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;
use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\NumberRangeFilterType; use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\NumberRangeFilterType;
use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\DateRangeFilterType; use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\DateRangeFilterType;
@ -33,7 +34,7 @@ class EntryFilterType extends AbstractType
$this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null; $this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null;
if (null === $this->user || !is_object($this->user)) { if (null === $this->user || !is_object($this->user)) {
return null; return;
} }
} }
@ -41,6 +42,14 @@ class EntryFilterType extends AbstractType
{ {
$builder $builder
->add('readingTime', NumberRangeFilterType::class, [ ->add('readingTime', NumberRangeFilterType::class, [
'left_number_options' => [
'condition_operator' => FilterOperands::OPERATOR_GREATER_THAN_EQUAL,
'attr' => ['min' => 0],
],
'right_number_options' => [
'condition_operator' => FilterOperands::OPERATOR_LOWER_THAN_EQUAL,
'attr' => ['min' => 0],
],
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
$lower = $values['value']['left_number'][0]; $lower = $values['value']['left_number'][0];
$upper = $values['value']['right_number'][0]; $upper = $values['value']['right_number'][0];

View file

@ -215,7 +215,7 @@ entry:
# share_email_label: 'Email' # share_email_label: 'Email'
# public_link: 'public link' # public_link: 'public link'
# delete_public_link: 'delete public link' # delete_public_link: 'delete public link'
download: 'Download' # export: 'Export'
# print: 'Print' # print: 'Print'
problem: problem:
label: 'Problemer?' label: 'Problemer?'

View file

@ -216,7 +216,7 @@ entry:
share_email_label: 'E-Mail' share_email_label: 'E-Mail'
public_link: 'Öffentlicher Link' public_link: 'Öffentlicher Link'
delete_public_link: 'Lösche öffentlichen Link' delete_public_link: 'Lösche öffentlichen Link'
download: 'Herunterladen' export: 'Exportieren'
print: 'Drucken' print: 'Drucken'
problem: problem:
label: 'Probleme?' label: 'Probleme?'

View file

@ -216,7 +216,7 @@ entry:
share_email_label: 'Email' share_email_label: 'Email'
public_link: 'public link' public_link: 'public link'
delete_public_link: 'delete public link' delete_public_link: 'delete public link'
download: 'Download' export: 'Export'
print: 'Print' print: 'Print'
problem: problem:
label: 'Problems?' label: 'Problems?'

View file

@ -216,7 +216,7 @@ entry:
share_email_label: 'e-mail' share_email_label: 'e-mail'
public_link: 'enlace público' public_link: 'enlace público'
delete_public_link: 'eliminar enlace público' delete_public_link: 'eliminar enlace público'
download: 'Descargar' export: 'Exportar'
print: 'Imprimir' print: 'Imprimir'
problem: problem:
label: '¿Algún problema?' label: '¿Algún problema?'

View file

@ -216,7 +216,7 @@ entry:
share_email_label: 'نشانی ایمیل' share_email_label: 'نشانی ایمیل'
# public_link: 'public link' # public_link: 'public link'
# delete_public_link: 'delete public link' # delete_public_link: 'delete public link'
download: 'بارگیری' export: 'بارگیری'
print: 'چاپ' print: 'چاپ'
problem: problem:
label: 'مشکلات؟' label: 'مشکلات؟'

View file

@ -216,7 +216,7 @@ entry:
share_email_label: "Courriel" share_email_label: "Courriel"
public_link: "Lien public" public_link: "Lien public"
delete_public_link: "Supprimer le lien public" delete_public_link: "Supprimer le lien public"
download: "Télécharger" export: "Exporter"
print: "Imprimer" print: "Imprimer"
problem: problem:
label: "Un problème ?" label: "Un problème ?"

View file

@ -216,7 +216,7 @@ entry:
share_email_label: 'E-mail' share_email_label: 'E-mail'
# public_link: 'public link' # public_link: 'public link'
# delete_public_link: 'delete public link' # delete_public_link: 'delete public link'
download: 'Download' export: 'Esporta'
print: 'Stampa' print: 'Stampa'
problem: problem:
label: 'Problemi?' label: 'Problemi?'

View file

@ -216,7 +216,7 @@ entry:
share_email_label: 'Corrièl' share_email_label: 'Corrièl'
public_link: 'ligam public' public_link: 'ligam public'
delete_public_link: 'suprimir lo ligam public' delete_public_link: 'suprimir lo ligam public'
download: 'Telecargar' export: 'Exportar'
print: 'Imprimir' print: 'Imprimir'
problem: problem:
label: 'Un problèma ?' label: 'Un problèma ?'

View file

@ -216,7 +216,7 @@ entry:
share_email_label: 'Adres email' share_email_label: 'Adres email'
public_link: 'Publiczny link' public_link: 'Publiczny link'
delete_public_link: 'Usuń publiczny link' delete_public_link: 'Usuń publiczny link'
download: 'Pobierz' export: 'Export'
print: 'Drukuj' print: 'Drukuj'
problem: problem:
label: 'Problemy' label: 'Problemy'

View file

@ -216,7 +216,7 @@ entry:
share_email_label: 'E-mail' share_email_label: 'E-mail'
public_link: 'link público' public_link: 'link público'
delete_public_link: 'apagar link público' delete_public_link: 'apagar link público'
download: 'Download' export: 'Exportar'
print: 'Imprimir' print: 'Imprimir'
problem: problem:
label: 'Problemas?' label: 'Problemas?'

View file

@ -216,7 +216,7 @@ entry:
share_email_label: 'E-mail' share_email_label: 'E-mail'
# public_link: 'public link' # public_link: 'public link'
# delete_public_link: 'delete public link' # delete_public_link: 'delete public link'
download: 'Descarcă' export: 'Descarcă'
# print: 'Print' # print: 'Print'
problem: problem:
label: 'Probleme?' label: 'Probleme?'

View file

@ -216,7 +216,7 @@ entry:
share_email_label: 'E-posta' share_email_label: 'E-posta'
# public_link: 'public link' # public_link: 'public link'
# delete_public_link: 'delete public link' # delete_public_link: 'delete public link'
download: 'İndir' export: 'Dışa Aktar'
# print: 'Print' # print: 'Print'
problem: problem:
label: 'Bir sorun mu var?' label: 'Bir sorun mu var?'

View file

@ -14,7 +14,7 @@
<ul> <ul>
<li><a href="{{ path('developer_howto_firstapp') }}">{{ 'developer.how_to_first_app'|trans }}</a></li> <li><a href="{{ path('developer_howto_firstapp') }}">{{ 'developer.how_to_first_app'|trans }}</a></li>
<li><a href="http://doc.wallabag.org/en/master/developer/api.html">{{ 'developer.full_documentation'|trans }}</a></li> <li><a href="https://doc.wallabag.org/en/developer/api/readme.html">{{ 'developer.full_documentation'|trans }}</a></li>
<li><a href="{{ path('nelmio_api_doc_index') }}">{{ 'developer.list_methods'|trans }}</a></li> <li><a href="{{ path('nelmio_api_doc_index') }}">{{ 'developer.list_methods'|trans }}</a></li>
</ul> </ul>

View file

@ -34,9 +34,10 @@
<div id="set2" class="col s12"> <div id="set2" class="col s12">
<dl> <dl>
<dt>{{ 'about.getting_help.documentation'|trans }}</dt> <dt>{{ 'about.getting_help.documentation'|trans }}</dt>
<dd><a href="http://doc.wallabag.org/en/master/">english</a></dd> <dd><a href="https://doc.wallabag.org/en/">english</a></dd>
<dd><a href="http://doc.wallabag.org/fr/master/">français</a></dd> <dd><a href="https://doc.wallabag.org/fr/">français</a></dd>
<dd><a href="http://doc.wallabag.org/de/master/">deutsch</a></dd> <dd><a href="https://doc.wallabag.org/de/">deutsch</a></dd>
<dd><a href="https://doc.wallabag.org/it/">italiano</a></dd>
<dt>{{ 'about.getting_help.bug_reports'|trans }}</dt> <dt>{{ 'about.getting_help.bug_reports'|trans }}</dt>
<dd>{{ 'about.getting_help.support'|trans|raw }}</dd> <dd>{{ 'about.getting_help.support'|trans|raw }}</dd>
@ -46,7 +47,7 @@
<div id="set3" class="col s12"> <div id="set3" class="col s12">
<dl> <dl>
<dt>{{ 'about.helping.description'|trans }}</dt> <dt>{{ 'about.helping.description'|trans }}</dt>
<dd>{{ 'about.helping.by_contributing_2'|trans }} <a href="https://github.com/wallabag/wallabag/issues/1254">{{ 'about.helping.by_contributing'|trans }}</a></dd> <dd>{{ 'about.helping.by_contributing'|trans }} <a href="https://github.com/wallabag/wallabag/issues/1254">{{ 'about.helping.by_contributing_2'|trans }}</a></dd>
<dd><a href="{{ paypal_url }}">{{ 'about.helping.by_paypal'|trans }}</a></dd> <dd><a href="{{ paypal_url }}">{{ 'about.helping.by_paypal'|trans }}</a></dd>
</dl> </dl>
</div> </div>

View file

@ -69,8 +69,8 @@
<div class="card-action"> <div class="card-action">
<ul> <ul>
<li><a href="{{ path('developer') }}">{{ 'quickstart.developer.create_application'|trans }}</a></li> <li><a href="{{ path('developer') }}">{{ 'quickstart.developer.create_application'|trans }}</a></li>
<li><a href="http://doc.wallabag.org/en/master/developer/docker.html">{{ 'quickstart.developer.use_docker'|trans }}</a></li> <li><a href="https://doc.wallabag.org/en/developer/docker.html">{{ 'quickstart.developer.use_docker'|trans }}</a></li>
<li><a href="http://doc.wallabag.org/en/master/index.html#dev-docs">{{ 'quickstart.more'|trans }}</a></li> <li><a href="https://doc.wallabag.org/">{{ 'quickstart.more'|trans }}</a></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -84,9 +84,9 @@
</div> </div>
<div class="card-action"> <div class="card-action">
<ul> <ul>
<li><a href="http://doc.wallabag.org/en/master/user/annotations.html">{{ 'quickstart.docs.annotate'|trans }}</a></li> <li><a href="https://doc.wallabag.org/en/user/articles/annotations.html">{{ 'quickstart.docs.annotate'|trans }}</a></li>
<li><a href="http://doc.wallabag.org/en/master/user/download_articles.html">{{ 'quickstart.docs.export'|trans }}</a></li> <li><a href="https://doc.wallabag.org/en/user/articles/download.html">{{ 'quickstart.docs.export'|trans }}</a></li>
<li><a href="http://doc.wallabag.org/">{{ 'quickstart.docs.all_docs'|trans }}</a></li> <li><a href="https://doc.wallabag.org/">{{ 'quickstart.docs.all_docs'|trans }}</a></li>
</ul> </ul>
</div> </div>
</div> </div>

View file

@ -183,7 +183,7 @@
<li class="bold"> <li class="bold">
<a class="waves-effect collapsible-header"> <a class="waves-effect collapsible-header">
<i class="material-icons small">file_download</i> <i class="material-icons small">file_download</i>
<span>{{ 'entry.view.left_menu.download'|trans }}</span> <span>{{ 'entry.view.left_menu.export'|trans }}</span>
</a> </a>
<div class="collapsible-body"> <div class="collapsible-body">
<ul> <ul>

View file

@ -4,6 +4,7 @@ namespace Tests\Wallabag\ApiBundle\Controller;
use Tests\Wallabag\ApiBundle\WallabagApiTestCase; use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Helper\ContentProxy;
class EntryRestControllerTest extends WallabagApiTestCase class EntryRestControllerTest extends WallabagApiTestCase
{ {
@ -375,6 +376,39 @@ class EntryRestControllerTest extends WallabagApiTestCase
$this->assertCount(3, $content['tags']); $this->assertCount(3, $content['tags']);
} }
public function testPostEntryWhenFetchContentFails()
{
/** @var \Symfony\Component\DependencyInjection\Container $container */
$container = $this->client->getContainer();
$contentProxy = $this->getMockBuilder(ContentProxy::class)
->disableOriginalConstructor()
->setMethods(['updateEntry'])
->getMock();
$contentProxy->expects($this->any())
->method('updateEntry')
->willThrowException(new \Exception('Test Fetch content fails'));
$container->set('wallabag_core.content_proxy', $contentProxy);
try {
$this->client->request('POST', '/api/entries.json', [
'url' => 'http://www.example.com/',
]);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertGreaterThan(0, $content['id']);
$this->assertEquals('http://www.example.com/', $content['url']);
} finally {
// Remove the created entry to avoid side effects on other tests
if (isset($content['id'])) {
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
$entry = $em->getReference('WallabagCoreBundle:Entry', $content['id']);
$em->remove($entry);
$em->flush();
}
}
}
public function testPostArchivedAndStarredEntry() public function testPostArchivedAndStarredEntry()
{ {
$this->client->request('POST', '/api/entries.json', [ $this->client->request('POST', '/api/entries.json', [

View file

@ -627,6 +627,26 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertCount(1, $crawler->filter('div[class=entry]')); $this->assertCount(1, $crawler->filter('div[class=entry]'));
} }
public function testFilterOnReadingTimeWithNegativeValue()
{
$this->logInAs('admin');
$client = $this->getClient();
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
$data = [
'entry_filter[readingTime][right_number]' => -22,
'entry_filter[readingTime][left_number]' => -22,
];
$crawler = $client->submit($form, $data);
// forcing negative value results in no entry displayed
$this->assertCount(0, $crawler->filter('div[class=entry]'));
}
public function testFilterOnReadingTimeOnlyUpper() public function testFilterOnReadingTimeOnlyUpper()
{ {
$this->logInAs('admin'); $this->logInAs('admin');