diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-07-25 17:46:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-25 17:46:41 +0200 |
commit | c523fd1ed76393d79367a598cd89a345f525ea23 (patch) | |
tree | 27f5505c6eff223b2c35a06b0d4bede31f4d4f3c | |
parent | 6206b312b2596fc465e0af994e58953b40e27cee (diff) | |
parent | 7a0648757ae57898af29d8cff403086432fa2ba5 (diff) | |
download | nextcloud-server-c523fd1ed76393d79367a598cd89a345f525ea23.tar.gz nextcloud-server-c523fd1ed76393d79367a598cd89a345f525ea23.zip |
Merge pull request #33342 from nextcloud/bugfix/delete-comments-that-have-expired-now
Delete comments that expired now
-rw-r--r-- | lib/private/Comments/Manager.php | 2 | ||||
-rw-r--r-- | tests/lib/Comments/ManagerTest.php | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index b82df1bccc8..53603e51e56 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -1652,7 +1652,7 @@ class Manager implements ICommentsManager { public function deleteCommentsExpiredAtObject(string $objectType, string $objectId = ''): bool { $qb = $this->dbConn->getQueryBuilder(); $qb->delete('comments') - ->where($qb->expr()->lt('expire_date', + ->where($qb->expr()->lte('expire_date', $qb->createNamedParameter($this->timeFactory->getDateTime(), IQueryBuilder::PARAM_DATE))) ->andWhere($qb->expr()->eq('object_type', $qb->createNamedParameter($objectType))); diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php index ae91efb8498..1af460e6f1b 100644 --- a/tests/lib/Comments/ManagerTest.php +++ b/tests/lib/Comments/ManagerTest.php @@ -753,6 +753,9 @@ class ManagerTest extends TestCase { $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file1', new \DateTime('-2 hours')); $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file2', new \DateTime('-2 hours')); $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime('-2 hours')); + $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime()); + $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime()); + $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime()); $manager = new Manager( $this->connection, @@ -777,7 +780,7 @@ class ManagerTest extends TestCase { } } $this->assertSame($exists, 0); - $this->assertSame($deleted, 3); + $this->assertSame($deleted, 6); // actor info is gone from DB, but when database interaction is alright, // we still expect to get true back |