Skip to content

Commit

Permalink
avoid fetching foto fix #912
Browse files Browse the repository at this point in the history
  • Loading branch information
dartcafe committed Jun 11, 2020
1 parent fe77207 commit a4a571a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
['name' => 'acl#getByToken', 'url' => '/acl/get/s/{token}', 'verb' => 'GET'],
['name' => 'acl#get', 'url' => '/acl/get/{id}', 'verb' => 'GET'],

['name' => 'system#get_site_users_and_groups', 'url' => '/siteusers/get/', 'verb' => 'POST'],
['name' => 'system#get_site_users_and_groups', 'url' => '/siteusers/get', 'verb' => 'POST'],
['name' => 'system#validate_public_username', 'url' => '/check/username', 'verb' => 'POST']
]
];
22 changes: 8 additions & 14 deletions lib/Controller/SystemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ private function isValidEmail($email) {
/**
* Get a list of NC users, groups and contacts
* @NoAdminRequired
* @PublicPage
* @NoCSRFRequired
* @param string $query
* @param bool $getGroups - search in groups
Expand All @@ -105,7 +106,7 @@ private function isValidEmail($email) {
*/
public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers = true, $getContacts = true, $getMail = false, $skipGroups = array(), $skipUsers = array()) {
$list = array();
// if (filter_var($query, FILTER_VALIDATE_EMAIL)) {

if ($this->isValidEmail($query)) {
$list[] = [
'id' => '',
Expand All @@ -124,10 +125,8 @@ public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers
];
}


if ($getGroups) {
$groups = $this->groupManager->search($query);
foreach ($groups as $group) {
foreach ($this->groupManager->search($query) as $group) {
if (!in_array($group->getGID(), $skipGroups)) {
$list[] = [
'id' => $group->getGID(),
Expand All @@ -149,8 +148,7 @@ public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers
}

if ($getUsers) {
$users = $this->userManager->searchDisplayName($query);
foreach ($users as $user) {
foreach ($this->userManager->searchDisplayName($query) as $user) {
if (!in_array($user->getUID(), $skipUsers)) {
$list[] = [
'id' => $user->getUID(),
Expand All @@ -170,13 +168,9 @@ public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers
}
}

$contactsManager = \OC::$server->getContactsManager();


if ($getContacts && $contactsManager->isEnabled()) {
$contacts = $contactsManager->search($query, array('FN', 'EMAIL', 'ORG', 'CATEGORIES'));
if ($getContacts && \OC::$server->getContactsManager()->isEnabled()) {

foreach ($contacts as $contact) {
foreach (\OC::$server->getContactsManager()->search($query, array('FN', 'EMAIL', 'ORG', 'CATEGORIES')) as $contact) {
if (!array_key_exists('isLocalSystemBook', $contact) && array_key_exists('EMAIL', $contact)) {

$emailAdresses = $contact['EMAIL'];
Expand All @@ -199,9 +193,9 @@ public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers
'type' => 'contact',
'icon' => 'icon-mail',
'avatarURL' => '',
'avatar' => isset($contact['PHOTO']) ? $contact['PHOTO'] : '',
'avatar' => '',
'lastLogin' => '',
'cloudId' => ''
'cloudId' => '',
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/components/SideBar/SideBarTabShare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default {
loadUsersAsync(query) {
this.isLoading = false
this.siteUsersListOptions.query = query
axios.post(generateUrl('apps/polls/siteusers/get/'), this.siteUsersListOptions)
axios.post(generateUrl('apps/polls/siteusers/get'), this.siteUsersListOptions)
.then((response) => {
this.users = response.data.siteusers
this.isLoading = false
Expand Down

0 comments on commit a4a571a

Please sign in to comment.