From: Georg Ehrke Date: Wed, 2 Sep 2020 10:25:54 +0000 (+0200) Subject: Do not display Offline statuses in the Dashboard widget X-Git-Tag: v20.0.0beta4~47^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5be49491d31f7f4a972fa5c2b7034b688f318c94;p=nextcloud-server.git Do not display Offline statuses in the Dashboard widget Signed-off-by: Georg Ehrke --- diff --git a/apps/user_status/lib/Db/UserStatusMapper.php b/apps/user_status/lib/Db/UserStatusMapper.php index 3bae5b37807..31156345b4e 100644 --- a/apps/user_status/lib/Db/UserStatusMapper.php +++ b/apps/user_status/lib/Db/UserStatusMapper.php @@ -82,7 +82,7 @@ class UserStatusMapper extends QBMapper { ->select('*') ->from($this->tableName) ->orderBy('status_timestamp', 'DESC') - ->where($qb->expr()->notIn('status', $qb->createNamedParameter([StatusService::ONLINE, StatusService::AWAY], IQueryBuilder::PARAM_STR_ARRAY))) + ->where($qb->expr()->notIn('status', $qb->createNamedParameter([StatusService::ONLINE, StatusService::AWAY, StatusService::OFFLINE], IQueryBuilder::PARAM_STR_ARRAY))) ->orWhere($qb->expr()->isNotNull('message_id')) ->orWhere($qb->expr()->isNotNull('custom_icon')) ->orWhere($qb->expr()->isNotNull('custom_message')); diff --git a/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php b/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php index 44ffa75c440..e86cee6d68a 100644 --- a/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php +++ b/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php @@ -70,8 +70,8 @@ class UserStatusMapperTest extends TestCase { $allResults = $this->mapper->findAllRecent(2, 0); $this->assertCount(2, $allResults); - $this->assertEquals('user1', $allResults[0]->getUserId()); - $this->assertEquals('user2', $allResults[1]->getUserId()); + $this->assertEquals('user2', $allResults[0]->getUserId()); + $this->assertEquals('user1', $allResults[1]->getUserId()); } public function testGetFind(): void { @@ -98,7 +98,7 @@ class UserStatusMapperTest extends TestCase { $user2Status = $this->mapper->findByUserId('user2'); $this->assertEquals('user2', $user2Status->getUserId()); $this->assertEquals('away', $user2Status->getStatus()); - $this->assertEquals(5000, $user2Status->getStatusTimestamp()); + $this->assertEquals(6000, $user2Status->getStatusTimestamp()); $this->assertEquals(false, $user2Status->getIsUserDefined()); $this->assertEquals('🏝', $user2Status->getCustomIcon()); $this->assertEquals('On vacation', $user2Status->getCustomMessage()); @@ -123,7 +123,7 @@ class UserStatusMapperTest extends TestCase { $user2Status = $statuses[1]; $this->assertEquals('user2', $user2Status->getUserId()); $this->assertEquals('away', $user2Status->getStatus()); - $this->assertEquals(5000, $user2Status->getStatusTimestamp()); + $this->assertEquals(6000, $user2Status->getStatusTimestamp()); $this->assertEquals(false, $user2Status->getIsUserDefined()); $this->assertEquals('🏝', $user2Status->getCustomIcon()); $this->assertEquals('On vacation', $user2Status->getCustomMessage()); @@ -239,7 +239,7 @@ class UserStatusMapperTest extends TestCase { $userStatus3 = new UserStatus(); $userStatus3->setUserId('user2'); $userStatus3->setStatus('away'); - $userStatus3->setStatusTimestamp(5000); + $userStatus3->setStatusTimestamp(6000); $userStatus3->setIsUserDefined(false); $userStatus3->setCustomIcon('🏝'); $userStatus3->setCustomMessage('On vacation');