зеркало из https://github.com/nextcloud/news.git
Revert "also read duplicate feed items read"
This reverts commit 30e66657b8
.
This commit is contained in:
Родитель
6ca631ff5c
Коммит
72e599bc87
|
@ -129,21 +129,15 @@ class ItemMapper extends NewsMapper {
|
|||
|
||||
|
||||
public function readFeed($feedId, $highestItemId, $time, $userId){
|
||||
$sql = 'UPDATE `*PREFIX*news_items`
|
||||
SET `status` = `status` & ?,
|
||||
`last_modified` = ?
|
||||
WHERE `id` IN (
|
||||
SELECT `b`.`id` FROM `*PREFIX*news_items` `a`,
|
||||
`*PREFIX*news_items` `b`
|
||||
WHERE `a`.`feed_id` = ?
|
||||
AND `a`.`id` <= ?
|
||||
AND `a`.`fingerprint` = `b`.`fingerprint`
|
||||
AND EXISTS (
|
||||
SELECT `id` FROM `*PREFIX*news_feeds`
|
||||
WHERE `user_id` = ?
|
||||
AND `id` = ?
|
||||
)
|
||||
)';
|
||||
$sql = 'UPDATE `*PREFIX*news_items` ' .
|
||||
'SET `status` = `status` & ? ' .
|
||||
', `last_modified` = ? ' .
|
||||
'WHERE `feed_id` = ? ' .
|
||||
'AND `id` <= ? ' .
|
||||
'AND EXISTS (' .
|
||||
'SELECT * FROM `*PREFIX*news_feeds` ' .
|
||||
'WHERE `user_id` = ? ' .
|
||||
'AND `id` = ? ) ';
|
||||
$params = [~StatusFlag::UNREAD, $time, $feedId, $highestItemId,
|
||||
$userId, $feedId];
|
||||
|
||||
|
|
|
@ -162,7 +162,6 @@ class NewsIntegrationTest extends PHPUnit_Framework_TestCase {
|
|||
$newItem->setLastModified($item['lastModified']);
|
||||
$newItem->setEnclosureMime($item['enclosureMime']);
|
||||
$newItem->setEnclosureLink($item['enclosureLink']);
|
||||
$newItem->generateSearchIndex();
|
||||
return $this->itemMapper->insert($newItem);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ class ItemMapperTest extends NewsIntegrationTest {
|
|||
30, 0, $status, false, $this->userId
|
||||
);
|
||||
|
||||
$this->assertEquals(2, count($items));
|
||||
$this->assertEquals(1, count($items));
|
||||
|
||||
$item = $this->items['a title1'];
|
||||
$item = $this->itemMapper->find($item->getId(), $this->userId);
|
||||
|
@ -210,7 +210,7 @@ class ItemMapperTest extends NewsIntegrationTest {
|
|||
|
||||
public function testFindAllUnreadOrStarred () {
|
||||
$items = $this->itemMapper->findAllUnreadOrStarred($this->userId);
|
||||
$this->assertEquals(5, count($items));
|
||||
$this->assertEquals(4, count($items));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,18 +100,6 @@
|
|||
}
|
||||
],
|
||||
"fourth feed": [
|
||||
{
|
||||
"status": 2,
|
||||
"body": "this is a body",
|
||||
"title": "a title9",
|
||||
"author": "my author",
|
||||
"guid": "a title9",
|
||||
"url": "http://google.de",
|
||||
"pubDate": 1234,
|
||||
"lastModified": 1234,
|
||||
"enclosureMime": "video/mpeg",
|
||||
"enclosureLink": "http://google.de/web.webm"
|
||||
},
|
||||
{
|
||||
"status": 0,
|
||||
"body": "this is a body",
|
||||
|
@ -153,4 +141,4 @@
|
|||
"enclosureLink": "http://google.de/web.webm"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -166,6 +166,24 @@ class ItemMapperTest extends \OCA\News\Tests\Unit\Db\MapperTestUtility {
|
|||
}
|
||||
|
||||
|
||||
public function testReadFeed(){
|
||||
$sql = 'UPDATE `*PREFIX*news_items` ' .
|
||||
'SET `status` = `status` & ? ' .
|
||||
', `last_modified` = ? ' .
|
||||
'WHERE `feed_id` = ? ' .
|
||||
'AND `id` <= ? ' .
|
||||
'AND EXISTS (' .
|
||||
'SELECT * FROM `*PREFIX*news_feeds` ' .
|
||||
'WHERE `user_id` = ? ' .
|
||||
'AND `id` = ? ) ';
|
||||
$params = [
|
||||
~StatusFlag::UNREAD, $this->updatedSince, 3, 6, $this->user, 3
|
||||
];
|
||||
$this->setMapperResult($sql, $params);
|
||||
$this->mapper->readFeed(3, 6, $this->updatedSince, $this->user);
|
||||
}
|
||||
|
||||
|
||||
public function testFindAllNew(){
|
||||
$sql = 'AND `items`.`last_modified` >= ? ';
|
||||
$sql = $this->makeSelectQueryStatus($sql, $this->status);
|
||||
|
@ -527,4 +545,4 @@ class ItemMapperTest extends \OCA\News\Tests\Unit\Db\MapperTestUtility {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче