From: Kevin Decherf Date: Sun, 15 Mar 2020 15:51:37 +0000 (+0100) Subject: Merge pull request #4293 from wallabag/dependabot/composer/friendsofsymfony/oauth2... X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=f3b1ec121d3f98a8db2a7db199dfd847d7b5f396;hp=f3db2579022d66e88fec167d12718fa4a952012a;p=github%2Fwallabag%2Fwallabag.git Merge pull request #4293 from wallabag/dependabot/composer/friendsofsymfony/oauth2-php-1.3.0 [Security] Bump friendsofsymfony/oauth2-php from 1.2.3 to 1.3.0 --- diff --git a/.travis.yml b/.travis.yml index 229e3e0e..c09bcd22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,12 +16,15 @@ cache: - $HOME/.npm - $HOME/.yarn-cache +if: | + type = pull_request OR \ + branch = master + php: - 7.1 - 7.2 - 7.3 - 7.4 - - nightly node_js: - "5" @@ -34,11 +37,10 @@ env: matrix: fast_finish: true include: - - php: 7.2 + - php: 7.3 env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run ASSETS=build DB=sqlite allow_failures: - php: 7.4 - - php: nightly # exclude v1 branches branches: diff --git a/Capfile b/Capfile deleted file mode 100644 index cc807112..00000000 --- a/Capfile +++ /dev/null @@ -1,15 +0,0 @@ -set :deploy_config_path, 'app/config/capistrano/deploy.rb' -set :stage_config_path, 'app/config/capistrano/deploy' - -# Load DSL and set up stages -require 'capistrano/setup' - -# Include default deployment tasks -require 'capistrano/deploy' - -require 'capistrano/composer' -require 'capistrano/file-permissions' -require 'capistrano/symfony' - -# Load custom tasks from `lib/capistrano/tasks` if you have any defined -Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 233be899..00000000 --- a/Gemfile +++ /dev/null @@ -1,6 +0,0 @@ -source "https://rubygems.org" - -gem 'capistrano', '~> 3.4' -gem 'capistrano-composer' -gem 'capistrano-symfony', '~> 1.0.0.rc1' -gem 'capistrano-file-permissions' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 7b13b399..00000000 --- a/Gemfile.lock +++ /dev/null @@ -1,37 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - capistrano (3.4.0) - i18n - rake (>= 10.0.0) - sshkit (~> 1.3) - capistrano-composer (0.0.6) - capistrano (>= 3.0.0.pre) - capistrano-file-permissions (1.0.0) - capistrano (~> 3.0) - capistrano-symfony (1.0.0.rc1) - capistrano (~> 3.1) - capistrano-composer (~> 0.0.3) - capistrano-file-permissions (~> 1.0) - colorize (0.7.7) - i18n (0.7.0) - net-scp (1.2.1) - net-ssh (>= 2.6.5) - net-ssh (2.9.2) - rake (10.4.2) - sshkit (1.7.1) - colorize (>= 0.7.0) - net-scp (>= 1.1.2) - net-ssh (>= 2.8.0) - -PLATFORMS - ruby - -DEPENDENCIES - capistrano (~> 3.4) - capistrano-composer - capistrano-file-permissions - capistrano-symfony (~> 1.0.0.rc1) - -BUNDLED WITH - 1.13.5 diff --git a/app/config/capistrano/deploy.rb b/app/config/capistrano/deploy.rb deleted file mode 100644 index fee04620..00000000 --- a/app/config/capistrano/deploy.rb +++ /dev/null @@ -1,19 +0,0 @@ -# config valid only for current version of Capistrano - -set :application, 'wallabag' -set :repo_url, 'git@github.com:wallabag/wallabag.git' - -set :ssh_user, 'framasoft_bag' -server '78.46.248.87', user: fetch(:ssh_user), roles: %w{web app db} - -set :format, :pretty -set :log_level, :info -# set :log_level, :debug - -set :composer_install_flags, '--no-dev --prefer-dist --no-interaction --optimize-autoloader' - -set :linked_files, %w{app/config/parameters.yml} -set :linked_dirs, [fetch(:log_path), "var/sessions", "web/uploads", "data"] -set :keep_releases, 3 - -after 'deploy:updated', 'symfony:cache:clear' diff --git a/app/config/capistrano/deploy/production.rb b/app/config/capistrano/deploy/production.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/app/config/capistrano/deploy/staging.rb b/app/config/capistrano/deploy/staging.rb deleted file mode 100644 index ad899a85..00000000 --- a/app/config/capistrano/deploy/staging.rb +++ /dev/null @@ -1,2 +0,0 @@ -set :branch, 'master' -set :deploy_to, '/var/www/v2.wallabag.org/web/' diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index 282fd733..cec8d499 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php @@ -68,6 +68,18 @@ class ExportController extends Controller ); $title = 'Tag ' . $tag->getLabel(); + } elseif ('search' === $category) { + $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); + $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); + + $entries = $repository->getBuilderForSearchByUser( + $this->getUser()->getId(), + $searchTerm, + $currentRoute + )->getQuery() + ->getResult(); + + $title = 'Search ' . $searchTerm; } else { $entries = $repository ->$methodBuilder($this->getUser()->getId()) diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index b747ed84..4182628f 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig @@ -96,16 +96,21 @@ {% if tag is defined %} {% set currentTag = tag %} {% endif %} + {% set exportSearchTerm = null %} + {% if searchTerm is defined %} + {% set exportSearchTerm = searchTerm %} + {% endif %} + {% set previousRoute = app.request.attributes.get('currentRoute') %}

{{ 'entry.list.export_title'|trans }}

× diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index 3906e1e0..0c21dc5d 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig @@ -63,15 +63,20 @@ {% if tag is defined %} {% set currentTag = tag.slug %} {% endif %} + {% set exportSearchTerm = null %} + {% if searchTerm is defined %} + {% set exportSearchTerm = searchTerm %} + {% endif %} + {% set previousRoute = app.request.attributes.get('currentRoute') %}

{{ 'entry.list.export_title'|trans }}

diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index d7ce7c45..36822ab3 100644 --- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php @@ -3,9 +3,13 @@ namespace Tests\Wallabag\CoreBundle\Controller; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; class ExportControllerTest extends WallabagCoreTestCase { + private $adminEntry; + private $bobEntry; + public function testLogin() { $client = $this->getClient(); @@ -243,6 +247,30 @@ class ExportControllerTest extends WallabagCoreTestCase $this->assertContains('foo', $content[0]['tags']); } + public function testJsonExportFromSearch() + { + $this->setUpForJsonExportFromSearch(); + + $this->logInAs('admin'); + $client = $this->getClient(); + + ob_start(); + $crawler = $client->request('GET', '/export/search.json?search_entry[term]=entry+search¤tRoute=homepage'); + ob_end_clean(); + + $this->assertSame(200, $client->getResponse()->getStatusCode()); + + $headers = $client->getResponse()->headers; + $this->assertSame('application/json', $headers->get('content-type')); + $this->assertSame('attachment; filename="Search entry search articles.json"', $headers->get('content-disposition')); + $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); + + $content = json_decode($client->getResponse()->getContent(), true); + $this->assertCount(1, $content); + + $this->tearDownForJsonExportFromSearch(); + } + public function testXmlExport() { $this->logInAs('admin'); @@ -282,6 +310,41 @@ class ExportControllerTest extends WallabagCoreTestCase $this->assertNotEmpty('updated_at', (string) $content->entry[0]->updated_at); } + private function setUpForJsonExportFromSearch() + { + $client = $this->getClient(); + $em = $this->getEntityManager(); + + $userRepository = $client->getContainer() + ->get('wallabag_user.user_repository.test'); + + $user = $userRepository->findOneByUserName('admin'); + $this->adminEntry = new Entry($user); + $this->adminEntry->setUrl('http://0.0.0.0/entry-search-admin'); + $this->adminEntry->setTitle('test title entry search admin'); + $this->adminEntry->setContent('this is my content /o/'); + $em->persist($this->adminEntry); + + $user = $userRepository->findOneByUserName('bob'); + $this->bobEntry = new Entry($user); + $this->bobEntry->setUrl('http://0.0.0.0/entry-search-bob'); + $this->bobEntry->setTitle('test title entry search bob'); + $this->bobEntry->setContent('this is my content /o/'); + $em->persist($this->bobEntry); + + $em->flush(); + } + + private function tearDownForJsonExportFromSearch() + { + $em = $this->getEntityManager(); + + $em->remove($this->adminEntry); + $em->remove($this->bobEntry); + + $em->flush(); + } + private function getSanitizedFilename($title) { return preg_replace('/[^A-Za-z0-9\- \']/', '', iconv('utf-8', 'us-ascii//TRANSLIT', $title));