mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-01-29 18:52:18 +01:00
Contacts: Generate prettier target for shared address books.
This commit is contained in:
parent
efad313280
commit
275c98cce8
@ -41,17 +41,18 @@ class Share_Backend_Addressbook implements \OCP\Share_Backend_Collection {
|
||||
* If it does generate a new name e.g. name_#
|
||||
*/
|
||||
public function generateTarget($itemSource, $shareWith, $exclude = null) {
|
||||
$addressbook = Addressbook::find( $itemSource );
|
||||
$addressbook = Addressbook::find($itemSource);
|
||||
$user_addressbooks = array();
|
||||
foreach(Addressbook::all($shareWith) as $user_addressbook) {
|
||||
$user_addressbooks[] = $user_addressbook['displayname'];
|
||||
}
|
||||
$name = $addressbook['displayname'];
|
||||
$name = $addressbook['displayname'] . '(' . $addressbook['userid'] . ')';
|
||||
$suffix = '';
|
||||
while (in_array($name.$suffix, $user_addressbooks)) {
|
||||
$suffix++;
|
||||
}
|
||||
|
||||
$suffix = $suffix ? ' ' . $suffix : '';
|
||||
return $name.$suffix;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user