mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 22:27:31 -04:00
Rename vars and move logic to method
Signed-off-by: Vitor Mattos <vitor@php.rio>
This commit is contained in:
parent
9a2736bbc9
commit
898e87fe1a
1 changed files with 8 additions and 7 deletions
|
|
@ -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');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue