Mark all imported articles as read

This commit is contained in:
Thomas Citharel
2016-02-12 15:59:13 +01:00
committed by Jeremy Benoist
parent 7d12fd0628
commit fe8b37c137
6 changed files with 29 additions and 2 deletions

View File

@ -19,6 +19,7 @@ class WallabagV1Import implements ImportInterface
protected $skippedEntries = 0;
protected $importedEntries = 0;
protected $filepath;
protected $markAsRead;
public function __construct(EntityManager $em, ContentProxy $contentProxy)
{
@ -120,6 +121,18 @@ class WallabagV1Import implements ImportInterface
return $this;
}
/**
* Set whether articles must be all marked as read.
*
* @param bool $markAsRead
*/
public function setMarkAsRead($markAsRead)
{
$this->markAsRead = $markAsRead;
return $this;
}
/**
* @param $entries
*/
@ -160,7 +173,7 @@ class WallabagV1Import implements ImportInterface
);
}
$entry->setArchived($importedEntry['is_read']);
$entry->setArchived($importedEntry['is_read'] || $this->markAsRead);
$entry->setStarred($importedEntry['is_fav']);
$this->em->persist($entry);

View File

@ -51,7 +51,7 @@ class WallabagV2Import extends WallabagV1Import implements ImportInterface
$entry = new Entry($this->user);
$entry->setUrl($importedEntry['url']);
$entry->setTitle($importedEntry['title']);
$entry->setArchived($importedEntry['is_archived']);
$entry->setArchived($importedEntry['is_archived'] || $this->markAsRead);
$entry->setStarred($importedEntry['is_starred']);
$entry->setContent($importedEntry['content']);
$entry->setReadingTime($importedEntry['reading_time']);