]> source.dussan.org Git - nextcloud-server.git/commitdiff
Do not display Offline statuses in the Dashboard widget
authorGeorg Ehrke <developer@georgehrke.com>
Wed, 2 Sep 2020 10:25:54 +0000 (12:25 +0200)
committerGeorg Ehrke <developer@georgehrke.com>
Mon, 7 Sep 2020 09:30:15 +0000 (11:30 +0200)
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
apps/user_status/lib/Db/UserStatusMapper.php
apps/user_status/tests/Unit/Db/UserStatusMapperTest.php

index 3bae5b378073fc6c567ad66e361551291062f223..31156345b4ec73dd1acdc6d6db7a74f3dfaaf763 100644 (file)
@@ -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'));
index 44ffa75c440e2fd0237f9b88cb8081ef57858551..e86cee6d68a656f48fe24c762caf42075c1d9f7e 100644 (file)
@@ -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');