summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2021-03-23 20:05:58 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-03-23 21:11:25 +0100
commitbaf1ca8ec9e3964c97c6e11ca9c6a56e38b8fe48 (patch)
tree146a42d1be66f2ca81443f0bf084cc70d4dc2a35
parent4e1d6eaa32524c119c4d2838e904aa02d3fced1b (diff)
DB: Don't show deleted feed items
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
-rw-r--r--AUTHORS.md3
-rw-r--r--CHANGELOG.md3
-rw-r--r--lib/Db/ItemMapperV2.php6
-rw-r--r--tests/Unit/Db/ItemMapperAfterTest.php28
-rw-r--r--tests/Unit/Db/ItemMapperPaginatedTest.php45
5 files changed, 57 insertions, 28 deletions
diff --git a/AUTHORS.md b/AUTHORS.md
index d2b3642ed..6062595a1 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -17,6 +17,7 @@
* [Thomas Müller](mailto:thomas.mueller@tmit.eu)
* [Hoàng Đức Hiếu](mailto:hdhoang@zahe.me)
* [Daniel Opitz](mailto:git@copynpaste.de)
+* [Marco Nassabain](mailto:marco.nassabain@hotmail.com)
* [Sean Molenaar](mailto:sean@m2mobi.com)
* [rakekniven](mailto:mark.ziegler@rakekniven.de)
* [David-Development](mailto:david-dev@live.de)
@@ -25,6 +26,7 @@
* [Lukas Reschke](mailto:lukas@owncloud.com)
* [Bart Visscher](mailto:bartv@thisnet.nl)
* [Christian Elmer](mailto:christian@keinkurt.de)
+* [Jimmy Huynh](mailto:jimmy.huynh@etu.unistra.fr)
* [Thomas Tanghus](mailto:thomas@tanghus.net)
* [Volkan Gezer](mailto:volkangezer@gmail.com)
* [Xéfir Destiny](mailto:xefir@crystalyx.net)
@@ -47,6 +49,7 @@
* [Gioele Falcetti](mailto:thegio.f@gmail.com)
* [Igor Bubelov](mailto:igor@bubelov.com)
* [Jan C. Borchardt](mailto:hey@jancborchardt.net)
+* [Jimmy Huynh](mailto:linkatox@gmail.com)
* [John Kristensen](mailto:john@jerrykan.com)
* [Keunes](mailto:11229646+keunes@users.noreply.github.com)
* [Konrad Graefe](mailto:konradgraefe@aol.com)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a7aff9a6d..c895ac303 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,8 +8,9 @@ The format is almost based on [Keep a Changelog](https://keepachangelog.com/en/1
- Add BATS as integration tests
- Update FeedFetcher to import categories from feeds (#1248)
- Update serialization of item to include categories (#1248)
-
+
### Fixed
+- Do not show deleted feeds in item list
## [15.4.0-beta2] - 2021-02-27
### Fixed
diff --git a/lib/Db/ItemMapperV2.php b/lib/Db/ItemMapperV2.php
index 33b4611f9..93457d4f9 100644
--- a/lib/Db/ItemMapperV2.php
+++ b/lib/Db/ItemMapperV2.php
@@ -316,6 +316,7 @@ class ItemMapperV2 extends NewsMapperV2
->andWhere('items.last_modified >= :updatedSince')
->andWhere('feeds.user_id = :userId')
->andWhere('feeds.id = :feedId')
+ ->andWhere('feeds.deleted_at = 0')
->setParameters([
'updatedSince' => $updatedSince,
'feedId' => $feedId,
@@ -353,6 +354,7 @@ class ItemMapperV2 extends NewsMapperV2
->innerJoin('feeds', FolderMapperV2::TABLE_NAME, 'folders', 'feeds.folder_id = folders.id')
->andWhere('items.last_modified >= :updatedSince')
->andWhere('feeds.user_id = :userId')
+ ->andWhere('feeds.deleted_at = 0')
->andWhere('folders.id = :folderId')
->setParameters(['updatedSince' => $updatedSince, 'folderId' => $folderId, 'userId' => $userId])
->orderBy('items.last_modified', 'DESC')
@@ -381,6 +383,7 @@ class ItemMapperV2 extends NewsMapperV2
->from($this->tableName, 'items')
->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id')
->andWhere('items.last_modified >= :updatedSince')
+ ->andWhere('feeds.deleted_at = 0')
->andWhere('feeds.user_id = :userId')
->setParameters(['updatedSince' => $updatedSince, 'userId' => $userId])
->orderBy('items.last_modified', 'DESC')
@@ -443,6 +446,7 @@ class ItemMapperV2 extends NewsMapperV2
$builder->select('items.*')
->from($this->tableName, 'items')
->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id')
+ ->andWhere('feeds.deleted_at = 0')
->andWhere('feeds.user_id = :userId')
->andWhere('items.feed_id = :feedId')
->setParameter('userId', $userId)
@@ -503,6 +507,7 @@ class ItemMapperV2 extends NewsMapperV2
->from($this->tableName, 'items')
->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id')
->andWhere('feeds.user_id = :userId')
+ ->andWhere('feeds.deleted_at = 0')
->andWhere($folderWhere)
->setParameter('userId', $userId)
->setMaxResults($limit)
@@ -554,6 +559,7 @@ class ItemMapperV2 extends NewsMapperV2
->from($this->tableName, 'items')
->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id')
->andWhere('feeds.user_id = :userId')
+ ->andWhere('feeds.deleted_at = 0')
->setParameter('userId', $userId)
->setMaxResults($limit)
->orderBy('items.last_modified', ($oldestFirst ? 'ASC' : 'DESC'))
diff --git a/tests/Unit/Db/ItemMapperAfterTest.php b/tests/Unit/Db/ItemMapperAfterTest.php
index dbb883fc9..5c536e1bf 100644
--- a/tests/Unit/Db/ItemMapperAfterTest.php
+++ b/tests/Unit/Db/ItemMapperAfterTest.php
@@ -78,12 +78,13 @@ class ItemMapperAfterTest extends MapperTestUtility
->with('items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id')
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.user_id = :userId'],
- ['feeds.id = :feedId']
+ ['feeds.id = :feedId'],
+ ['feeds.deleted_at = 0']
)
->will($this->returnSelf());
@@ -142,12 +143,13 @@ class ItemMapperAfterTest extends MapperTestUtility
->with('items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id')
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.user_id = :userId'],
['feeds.id = :feedId'],
+ ['feeds.deleted_at = 0'],
['items.unread = 1']
)
->will($this->returnSelf());
@@ -210,11 +212,12 @@ class ItemMapperAfterTest extends MapperTestUtility
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['folders.id = :folderId']
)
->will($this->returnSelf());
@@ -277,11 +280,12 @@ class ItemMapperAfterTest extends MapperTestUtility
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['folders.id = :folderId'],
['items.unread = 1']
)
@@ -342,10 +346,11 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.unread = 1']
)
@@ -405,10 +410,11 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.starred = 1']
)
@@ -468,10 +474,11 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId']
)
->will($this->returnSelf());
@@ -533,10 +540,11 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId']
)
->will($this->returnSelf());
@@ -574,4 +582,4 @@ class ItemMapperAfterTest extends MapperTestUtility
$this->assertEquals([Item::fromRow(['id' => 4])], $result);
}
-} \ No newline at end of file
+}
diff --git a/tests/Unit/Db/ItemMapperPaginatedTest.php b/tests/Unit/Db/ItemMapperPaginatedTest.php
index 2b4ac0c5f..e242833fb 100644
--- a/tests/Unit/Db/ItemMapperPaginatedTest.php
+++ b/tests/Unit/Db/ItemMapperPaginatedTest.php
@@ -81,10 +81,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
- ['feeds.user_id = :userId']
+ ['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0']
)
->will($this->returnSelf());
@@ -150,10 +151,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['items.id > :offset']
)
->will($this->returnSelf());
@@ -221,10 +223,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['items.id < :offset'],
['items.unread = 1']
)
@@ -235,13 +238,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['userId', 'jack'], ['offset', 10])
->will($this->returnSelf());
-
$this->builder->expects($this->exactly(1))
->method('setMaxResults')
->with(10)
->will($this->returnSelf());
-
$this->builder->expects($this->exactly(0))
->method('setFirstResult')
->with(10)
@@ -293,10 +294,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['items.id < :offset'],
['items.starred = 1']
)
@@ -367,10 +369,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(5))
+ $this->builder->expects($this->exactly(6))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['items.search_index LIKE :term0'],
['items.search_index LIKE :term1'],
['items.id < :offset'],
@@ -441,9 +444,10 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
['items.id < :offset']
@@ -513,9 +517,10 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
['items.id > :offset']
@@ -583,9 +588,10 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
['items.id < :offset'],
@@ -659,9 +665,10 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(5))
+ $this->builder->expects($this->exactly(6))
->method('andWhere')
->withConsecutive(
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
['items.search_index LIKE :term0'],
@@ -751,10 +758,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['x IS NULL'],
['items.id < :offset']
)
@@ -835,10 +843,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['x IS NULL'],
['items.id < :offset'],
['items.unread = 1']
@@ -920,10 +929,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['x IS NULL'],
['items.id > :offset'],
['items.unread = 1']
@@ -1008,10 +1018,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(5))
+ $this->builder->expects($this->exactly(6))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['x = y'],
['items.search_index LIKE :term0'],
['items.search_index LIKE :term1'],
@@ -1061,4 +1072,4 @@ class ItemMapperPaginatedTest extends MapperTestUtility
$this->assertEquals([Item::fromRow(['id' => 4])], $result);
}
-} \ No newline at end of file
+}