+ /**
+ * Fetch comment counts from the conversation
+ *
+ * @param array $uriids
+ * @return array
+ */
+ private function getCounts(array $uriids): array
+ {
+ $counts = [];
+
+ foreach (Post\Counts::get(['parent-uri-id' => $uriids, 'verb' => Activity::POST]) as $count) {
+ $counts[$count['parent-uri-id']] = ($counts[$count['parent-uri-id']] ?? 0) + $count['count'];
+ }
+
+ return $counts;
+ }
+
+ /**
+ * Fetch quote shares from the conversation
+ *
+ * @param array $uriids
+ * @return array
+ */
+ private function getQuoteShares(array $uriids): array
+ {
+ $condition = DBA::mergeConditions(['quote-uri-id' => $uriids], ["NOT `quote-uri-id` IS NULL"]);
+ $separator = chr(255) . chr(255) . chr(255);
+
+ $sql = "SELECT `quote-uri-id`, COUNT(*) AS `total`, GROUP_CONCAT(REPLACE(`name`, '" . $separator . "', ' ') SEPARATOR '" . $separator . "' LIMIT 50) AS `title` FROM `post-content` INNER JOIN `post` ON `post`.`uri-id` = `post-content`.`uri-id` INNER JOIN `contact` ON `post`.`author-id` = `contact`.`id` WHERE " . array_shift($condition) . " GROUP BY `quote-uri-id`";
+
+ $quotes = [];
+
+ $rows = DBA::p($sql, $condition);
+ while ($row = DBA::fetch($rows)) {
+ $quotes[$row['quote-uri-id']]['total'] = $row['total'];
+ $quotes[$row['quote-uri-id']]['title'] = array_unique(explode($separator, $row['title']));
+ }
+ DBA::close($rows);
+
+ return $quotes;
+ }
+