1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-19 08:52:22 +01:00

Merge pull request #686 from owncloud/issue-654

Display correct number of contacts in shared addressbooks.
This commit is contained in:
Bernhard Reiter 2014-11-07 21:11:00 +01:00
commit 0e170091e4
2 changed files with 9 additions and 2 deletions

View File

@ -751,7 +751,7 @@ OC.Contacts = OC.Contacts || {};
$elem = $elem.length ? $elem : (tmpl).octemplate({
id: shared.id,
type: 'shared',
num: response.data.shared.length,
num: shared.length,
name: shared.displayname
});
$elem.find('.numcontacts').after(sharedindicator);

View File

@ -45,10 +45,17 @@ class GroupController extends Controller {
$favorites = $this->tags->getFavorites();
$shares = \OCP\Share::getItemsSharedWith('addressbook', \OCA\Contacts\Share\Addressbook::FORMAT_ADDRESSBOOKS);
$addressbookShare = new \OCA\Contacts\Share\Addressbook();
foreach ($shares as $key => $share) {
$children = $addressbookShare->getChildren($share['id']); // FIXME: This should be cheaper!
$shares[$key]['length'] = count($children);
}
$groups = array(
'categories' => $tags,
'favorites' => $favorites,
'shared' => \OCP\Share::getItemsSharedWith('addressbook', \OCA\Contacts\Share\Addressbook::FORMAT_ADDRESSBOOKS),
'shared' => $shares,
'lastgroup' => \OCP\Config::getUserValue(\OCP\User::getUser(), 'contacts', 'lastgroup', 'all'),
'sortorder' => \OCP\Config::getUserValue(\OCP\User::getUser(), 'contacts', 'groupsort', ''),
);