Merge pull request #3819 from stan3/pocket-import

Fix read & starred status in Pocket import
This commit is contained in:
Jérémy Benoist 2019-01-28 11:34:37 +01:00 committed by GitHub
commit 755753e3ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -206,10 +206,10 @@ class PocketImport extends AbstractImport
$this->fetchContent($entry, $url);
// 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted
$entry->setArchived(1 === $importedEntry['status'] || $this->markAsRead);
$entry->setArchived(1 === (int) $importedEntry['status'] || $this->markAsRead);
// 0 or 1 - 1 If the item is starred
$entry->setStarred(1 === $importedEntry['favorite']);
// 0 or 1 - 1 if the item is starred
$entry->setStarred(1 === (int) $importedEntry['favorite']);
$title = 'Untitled';
if (isset($importedEntry['resolved_title']) && '' !== $importedEntry['resolved_title']) {

View file

@ -226,6 +226,13 @@ class PocketImportTest extends TestCase
->method('getRepository')
->willReturn($entryRepo);
$this->em
->expects($this->any())
->method('persist')
->with($this->callback(function ($persistedEntry) {
return $persistedEntry->isArchived() && $persistedEntry->isStarred();
}));
$entry = new Entry($this->user);
$this->contentProxy