summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2022-01-12 10:43:34 -0300
committerVitor Mattos <vitor@php.rio>2022-01-21 08:37:07 -0300
commit898e87fe1a32be516ae1b33e4bdc283283e2e75a (patch)
tree612c276e4124b35850913cf9094d556ec1a91520 /lib
parent9a2736bbc9826ac66c90a315769d2d16c4c8b0d9 (diff)
downloadnextcloud-server-898e87fe1a32be516ae1b33e4bdc283283e2e75a.tar.gz
nextcloud-server-898e87fe1a32be516ae1b33e4bdc283283e2e75a.zip
Rename vars and move logic to method
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Comments/Manager.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index 382ffbb9028..5c7e532f177 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -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');