Could be useful when we want to update the content or when the content failed to be fetched.
Fix #1503
);
}
+ /**
+ * Reload an entry.
+ * Refetch content from the website and make it readable again.
+ *
+ * @param Entry $entry
+ *
+ * @Route("/reload/{id}", requirements={"id" = "\d+"}, name="reload_entry")
+ *
+ * @return \Symfony\Component\HttpFoundation\RedirectResponse
+ */
+ public function reloadAction(Entry $entry)
+ {
+ $this->checkUserAction($entry);
+
+ $message = 'Entry reloaded';
+ if (false === $this->updateEntry($entry)) {
+ $message = 'Failed to reload entry';
+ }
+
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ $message
+ );
+
+ return $this->redirect($this->generateUrl('view', array('id' => $entry->getId())));
+ }
+
/**
* Changes read status for an entry.
*
<ul class="links">
<li class="topPosF"><a href="#top" title="{% trans %}Back to top{% endtrans %}" class="tool top icon icon-arrow-up-thick"><span>{% trans %}Back to top{% endtrans %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.domainName|removeWww }}</span></a></li>
+ <li><a title="{% trans %}Reload content{% endtrans %}" href="{{ path('reload_entry', { 'id': entry.id }) }}"><span>{% trans %}Reload content{% endtrans %}</span></a></li>
<li><a title="{% trans %}Mark as read{% endtrans %}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
<li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li>
<li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}Delete{% endtrans %}</span></a></li>
<div class="collapsible-body"></div>
</li>
+ <li class="bold hide-on-med-and-down">
+ <a class="waves-effect collapsible-header" title="{% trans %}Reload content{% endtrans %}" href="{{ path('reload_entry', { 'id': entry.id }) }}" id="reload">
+ <i class="mdi-action-autorenew small"></i>
+ <span>{% trans %}Reload content{% endtrans %}</span>
+ </a>
+ <div class="collapsible-body"></div>
+ </li>
+
<li class="bold hide-on-med-and-down">
<a class="waves-effect collapsible-header" title="{% trans %}Mark as read{% endtrans %}" href="{{ path('archive_entry', { 'id': entry.id }) }}" id="markAsRead">
<i class="{% if entry.isArchived == 0 %}mdi-action-done{% else %}mdi-content-redo{% endif %} small"></i>
$this->assertContains($content->getTitle(), $client->getResponse()->getContent());
}
+ /**
+ * @depends testPostNewOk
+ *
+ * This test will require an internet connection.
+ */
+ public function testReload()
+ {
+ $this->logInAs('admin');
+ $client = $this->getClient();
+
+ $content = $client->getContainer()
+ ->get('doctrine.orm.entity_manager')
+ ->getRepository('WallabagCoreBundle:Entry')
+ ->findOneByUrl($this->url);
+
+ // empty content
+ $content->setContent('');
+ $client->getContainer()->get('doctrine.orm.entity_manager')->persist($content);
+ $client->getContainer()->get('doctrine.orm.entity_manager')->flush();
+
+ $client->request('GET', '/reload/'.$content->getId());
+
+ $this->assertEquals(302, $client->getResponse()->getStatusCode());
+
+ $content = $client->getContainer()
+ ->get('doctrine.orm.entity_manager')
+ ->getRepository('WallabagCoreBundle:Entry')
+ ->findOneByUrl($this->url);
+
+ $this->assertNotEmpty($content->getContent());
+ }
+
public function testEdit()
{
$this->logInAs('admin');