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-26 09:50:48 +0200
commit5ba75f4e228092edee4339977a17fb042c940800 (patch)
treefa603fdac5cbbe747437569dc33bf0514c47b429
parent3eb8b070fb85d325a91f31e228ba951eae326588 (diff)
db: no longer order by items.last_modified
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
-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 180ce80f4..76675a53f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ The format is almost based on [Keep a Changelog](https://keepachangelog.com/en/1
### Changed
### Fixed
+- newestId does not return newest ID but last updated
# Releases
## [15.4.4] - 2021-05-21
diff --git a/lib/Db/ItemMapperV2.php b/lib/Db/ItemMapperV2.php
index be80a6c64..5b1a7ece1 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) {
@@ -377,7 +375,6 @@ class ItemMapperV2 extends NewsMapperV2
'folderId' => $folderId,
'userId' => $userId,
])
- ->orderBy('items.last_modified', 'DESC')
->addOrderBy('items.id', 'DESC');
if ($hideRead === true) {
@@ -410,7 +407,6 @@ class ItemMapperV2 extends NewsMapperV2
'updatedSince' => number_format($updatedSince, 0, '.', ''),
'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());