]> source.dussan.org Git - nextcloud-server.git/commitdiff
Rename vars and move logic to method
authorVitor Mattos <vitor@php.rio>
Wed, 12 Jan 2022 13:43:34 +0000 (10:43 -0300)
committerVitor Mattos <vitor@php.rio>
Fri, 21 Jan 2022 11:37:07 +0000 (08:37 -0300)
Signed-off-by: Vitor Mattos <vitor@php.rio>
lib/private/Comments/Manager.php

index 382ffbb9028855406c9ed81349496034e6933b96..5c7e532f177176eada82323c855f8f17183caf69 100644 (file)
@@ -969,7 +969,7 @@ class Manager implements ICommentsManager {
                }
                $comments = [];
                if ($commentIds) {
-                       $comments = $this->getCommentsOnList($commentIds);
+                       $comments = $this->getCommentsById($commentIds);
                }
 
                return $comments;
@@ -996,9 +996,7 @@ class Manager implements ICommentsManager {
                        $commentIds[] = $data['message_id'];
                }
                $comments = [];
-               if ($commentIds) {
-                       $comments = $this->getCommentsOnList($commentIds);
-               }
+               $comments = $this->getCommentsById($commentIds);
 
                return $comments;
        }
@@ -1006,16 +1004,19 @@ class Manager implements ICommentsManager {
        /**
         * Get all comments on list
         *
-        * @param integer[] $objectIds
+        * @param integer[] $commentIds
         * @return IComment[]
         * @since 24.0.0
         */
-       private function getCommentsOnList(array $objectIds): array {
+       private function getCommentsById(array $commentIds): array {
+               if (!$commentIds) {
+                       return [];
+               }
                $query = $this->dbConn->getQueryBuilder();
 
                $query->select('*')
                        ->from('comments')
-                       ->where($query->expr()->in('id', $query->createNamedParameter($objectIds, IQueryBuilder::PARAM_STR_ARRAY)))
+                       ->where($query->expr()->in('id', $query->createNamedParameter($commentIds, IQueryBuilder::PARAM_STR_ARRAY)))
                        ->orderBy('creation_timestamp', 'DESC')
                        ->addOrderBy('id', 'DESC');