summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2021-05-04 21:05:27 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2021-05-27 19:12:55 +0200
commit74f09ee7160c6ec1d2e67e47b91e96ec863be455 (patch)
treeb4a708684cad3c07972b6b52ec5feaabb7e4f386
parent2159eccbf199703a60636d517b0645b771e8bb0a (diff)
db: no longer order by items.last_modified
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu> Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/Db/ItemMapperV2.php4
-rw-r--r--tests/Unit/Db/ItemMapperAfterTest.php16
-rw-r--r--tests/Unit/Db/ItemMapperTest.php2
4 files changed, 10 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 11d51812d..cecabbd45 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ The format is almost based on [Keep a Changelog](https://keepachangelog.com/en/1
### Fixed
- allow calling `/items?getRead=false` without a feed/folder (#1380 #1356)
+- newestId does not return newest ID but last updated (#1339)
## [15.x.x]
### Changed
diff --git a/lib/Db/ItemMapperV2.php b/lib/Db/ItemMapperV2.php
index 6e50a5fb5..d215b4e26 100644
--- a/lib/Db/ItemMapperV2.php
+++ b/lib/Db/ItemMapperV2.php
@@ -302,7 +302,6 @@ class ItemMapperV2 extends NewsMapperV2
->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id')
->where('feeds.user_id = :userId')
->setParameter('userId', $userId)
- ->orderBy('items.last_modified', 'DESC')
->addOrderBy('items.id', 'DESC')
->setMaxResults(1);
@@ -337,7 +336,6 @@ class ItemMapperV2 extends NewsMapperV2
'feedId' => $feedId,
'userId'=> $userId,
])
- ->orderBy('items.last_modified', 'DESC')
->addOrderBy('items.id', 'DESC');
if ($hideRead === true) {
@@ -373,7 +371,6 @@ class ItemMapperV2 extends NewsMapperV2
->andWhere('feeds.deleted_at = 0')
->andWhere('folders.id = :folderId')
->setParameters(['updatedSince' => $updatedSince, 'folderId' => $folderId, 'userId' => $userId])
- ->orderBy('items.last_modified', 'DESC')
->addOrderBy('items.id', 'DESC');
if ($hideRead === true) {
@@ -403,7 +400,6 @@ class ItemMapperV2 extends NewsMapperV2
->andWhere('feeds.deleted_at = 0')
->andWhere('feeds.user_id = :userId')
->setParameters(['updatedSince' => $updatedSince, 'userId' => $userId])
- ->orderBy('items.last_modified', 'DESC')
->addOrderBy('items.id', 'DESC');
switch ($feedType) {
diff --git a/tests/Unit/Db/ItemMapperAfterTest.php b/tests/Unit/Db/ItemMapperAfterTest.php
index 68bad19dc..9b6f02655 100644
--- a/tests/Unit/Db/ItemMapperAfterTest.php
+++ b/tests/Unit/Db/ItemMapperAfterTest.php
@@ -81,7 +81,7 @@ class ItemMapperAfterTest extends MapperTestUtility
])
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
@@ -152,7 +152,7 @@ class ItemMapperAfterTest extends MapperTestUtility
->with('unread', true)
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
@@ -220,7 +220,7 @@ class ItemMapperAfterTest extends MapperTestUtility
])
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
@@ -294,7 +294,7 @@ class ItemMapperAfterTest extends MapperTestUtility
->with('unread', true)
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
@@ -363,7 +363,7 @@ class ItemMapperAfterTest extends MapperTestUtility
->with('unread', true)
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
@@ -432,7 +432,7 @@ class ItemMapperAfterTest extends MapperTestUtility
->with('starred', true)
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
@@ -495,7 +495,7 @@ class ItemMapperAfterTest extends MapperTestUtility
])
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
@@ -561,7 +561,7 @@ class ItemMapperAfterTest extends MapperTestUtility
])
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
diff --git a/tests/Unit/Db/ItemMapperTest.php b/tests/Unit/Db/ItemMapperTest.php
index 12c022893..15ebbac1a 100644
--- a/tests/Unit/Db/ItemMapperTest.php
+++ b/tests/Unit/Db/ItemMapperTest.php
@@ -432,7 +432,7 @@ class ItemMapperTest extends MapperTestUtility
->with('items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id')
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());