Skip to content

Commit

Permalink
feat: Add share count including circles
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <chrng8@gmail.com>
  • Loading branch information
Pytal committed Jan 31, 2025
1 parent b90e3d2 commit f9c4a49
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/GuestManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,19 @@ public function getGuestsInfo(): array {
$shareCounts = $this->getShareCountForUsers($guests);
$createdBy = $this->config->getUserValueForUsers('guests', 'created_by', $guests);
return array_map(function ($uid) use ($createdBy, $displayNames, $shareCounts) {
$allSharesCount = count(array_merge(
$this->shareManager->getSharedWith($uid, IShare::TYPE_USER, null, -1, 0),
$this->shareManager->getSharedWith($uid, IShare::TYPE_GROUP, null, -1, 0),
$this->shareManager->getSharedWith($uid, IShare::TYPE_CIRCLE, null, -1, 0),
$this->shareManager->getSharedWith($uid, IShare::TYPE_GUEST, null, -1, 0),
$this->shareManager->getSharedWith($uid, IShare::TYPE_ROOM, null, -1, 0),
));
return [
'email' => $uid,
'display_name' => $displayNames[$uid] ?? $uid,
'created_by' => $createdBy[$uid] ?? '',
'share_count' => isset($shareCounts[$uid]) ? $shareCounts[$uid] : 0,
'share_count_with_circles' => $allSharesCount,
];
}, $guests);
}
Expand Down

0 comments on commit f9c4a49

Please sign in to comment.