Merge pull request #7827 from wallabag/fix-redirection-action-search

Fix redirection after action in search results
This commit is contained in:
Nicolas Lœuillet 2024-11-21 13:57:12 +01:00 committed by GitHub
commit 93e877f086
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 35 additions and 3 deletions

View file

@ -7,7 +7,7 @@
</div> </div>
</div> </div>
{% set current_path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %} {% set current_path = app.request.requesturi %}
<ul class="tools right"> <ul class="tools right">
<li> <li>

View file

@ -10,7 +10,7 @@
{% endif %} {% endif %}
{% include "@WallabagCore/Entry/Card/_content.html.twig" with {'entry': entry, 'withMetadata': true, 'subClass': 'metadata'} only %} {% include "@WallabagCore/Entry/Card/_content.html.twig" with {'entry': entry, 'withMetadata': true, 'subClass': 'metadata'} only %}
{% set current_path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %} {% set current_path = app.request.requesturi %}
<ul class="tools-list hide-on-small-only"> <ul class="tools-list hide-on-small-only">
<li> <li>

View file

@ -19,7 +19,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% set current_path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %} {% set current_path = app.request.requesturi %}
{% set list_mode = app.user.config.listMode %} {% set list_mode = app.user.config.listMode %}
{% set entries_with_archived_class_routes = ['tag_entries', 'search', 'all'] %} {% set entries_with_archived_class_routes = ['tag_entries', 'search', 'all'] %}
{% set current_route = app.request.attributes.get('_route') %} {% set current_route = app.request.attributes.get('_route') %}

View file

@ -1475,6 +1475,38 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute)); $this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
} }
public function testActionInSearchResults()
{
$this->logInAs('admin');
$client = $this->getTestClient();
$config = $this->getLoggedInUser()->getConfig();
$config->setActionMarkAsRead(ConfigEntity::REDIRECT_TO_CURRENT_PAGE);
$this->getEntityManager()->persist($config);
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
$entry->setTitle('ActionInSearchResults');
$this->getEntityManager()->persist($entry);
$this->getEntityManager()->flush();
// Search on unread list
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('form[name=search]')->form();
$data = [
'search_entry[term]' => 'ActionInSearchResults',
];
$crawler = $client->submit($form, $data);
$currentUrl = $client->getRequest()->getUri();
$element = $crawler->filter('a[data-action="delete"]')->link();
$client->click($element);
$client->followRedirect();
$nextUrl = $client->getRequest()->getUri();
$this->assertSame($currentUrl, $nextUrl);
}
public function dataForLanguage() public function dataForLanguage()
{ {
return [ return [