diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-10-30 15:10:21 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-10-30 15:59:43 +0100 |
commit | d5f1cef6420c7450ce960f469fd10557ea8fcdd9 (patch) | |
tree | cdc3245e7dd4e1bb280093ff56701b52383d7bcf /apps/comments/lib | |
parent | 61db8615f4921c12c4c7090e87701b1bdbb2c186 (diff) | |
download | nextcloud-server-d5f1cef6420c7450ce960f469fd10557ea8fcdd9.tar.gz nextcloud-server-d5f1cef6420c7450ce960f469fd10557ea8fcdd9.zip |
fix comment sorter
background: we have a flat hierarchy of comments, not a tree. therefore we
can also remove again the unnecessary additions.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/comments/lib')
-rw-r--r-- | apps/comments/lib/Collaboration/CommentersSorter.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/comments/lib/Collaboration/CommentersSorter.php b/apps/comments/lib/Collaboration/CommentersSorter.php index 8a24592c30b..b8bb745b3b8 100644 --- a/apps/comments/lib/Collaboration/CommentersSorter.php +++ b/apps/comments/lib/Collaboration/CommentersSorter.php @@ -84,12 +84,23 @@ class CommentersSorter implements ISorter { * @return array */ protected function retrieveCommentsInformation($type, $id) { - $comments = $this->commentsManager->getForObject($type, $id, 1); + $comments = $this->commentsManager->getForObject($type, $id); if(count($comments) === 0) { return []; } - return $this->commentsManager->getActorsInTree($comments[0]->getTopmostParentId()); + $actors = []; + foreach ($comments as $comment) { + if(!isset($actors[$comment->getActorType()])) { + $actors[$comment->getActorType()] = []; + } + if(!isset($actors[$comment->getActorType()][$comment->getActorId()])) { + $actors[$comment->getActorType()][$comment->getActorId()] = 1; + } else { + $actors[$comment->getActorType()][$comment->getActorId()]++; + } + } + return $actors; } protected function compare(array $a, array $b, array $commenters) { |