Skip to content
Snippets Groups Projects
Commit e9a57e28 authored by Björn Schießle's avatar Björn Schießle
Browse files

show display name instead of uid

parent 839f4bd9
No related branches found
No related tags found
No related merge requests found
...@@ -72,6 +72,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo ...@@ -72,6 +72,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
case 'email': case 'email':
// read post variables // read post variables
$user = OCP\USER::getUser(); $user = OCP\USER::getUser();
$displayName = OCP\User::getDisplayName();
$type = $_POST['itemType']; $type = $_POST['itemType'];
$link = $_POST['link']; $link = $_POST['link'];
$file = $_POST['file']; $file = $_POST['file'];
...@@ -81,13 +82,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo ...@@ -81,13 +82,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$l = OC_L10N::get('core'); $l = OC_L10N::get('core');
// setup the email // setup the email
$subject = (string)$l->t('User %s shared a file with you', $user); $subject = (string)$l->t('User %s shared a file with you', $displayName);
if ($type === 'dir') if ($type === 'dir')
$subject = (string)$l->t('User %s shared a folder with you', $user); $subject = (string)$l->t('User %s shared a folder with you', $displayName);
$text = (string)$l->t('User %s shared the file "%s" with you. It is available for download here: %s', array($user, $file, $link)); $text = (string)$l->t('User %s shared the file "%s" with you. It is available for download here: %s', array($displayName, $file, $link));
if ($type === 'dir') if ($type === 'dir')
$text = (string)$l->t('User %s shared the folder "%s" with you. It is available for download here: %s', array($user, $file, $link)); $text = (string)$l->t('User %s shared the folder "%s" with you. It is available for download here: %s', array($displayName, $file, $link));
$default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply'); $default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply');
...@@ -158,14 +159,14 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo ...@@ -158,14 +159,14 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
while ($count < 4 && count($users) == $limit) { while ($count < 4 && count($users) == $limit) {
$limit = 4 - $count; $limit = 4 - $count;
if ($sharePolicy == 'groups_only') { if ($sharePolicy == 'groups_only') {
$users = OC_Group::usersInGroups($groups, $_GET['search'], $limit, $offset); $users = OC_Group::DisplayNamesInGroups($groups, $_GET['search'], $limit, $offset);
} else { } else {
$users = OC_User::getUsers($_GET['search'], $limit, $offset); $users = OC_User::getDisplayNames($_GET['search'], $limit, $offset);
} }
$offset += $limit; $offset += $limit;
foreach ($users as $user) { foreach ($users as $displayName => $uid) {
if ((!isset($_GET['itemShares']) || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) || !in_array($user, $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) && $user != OC_User::getUser()) { if ((!isset($_GET['itemShares']) || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) || !in_array($uid, $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) && $uid != OC_User::getUser()) {
$shareWith[] = array('label' => $user, 'value' => array('shareType' => OCP\Share::SHARE_TYPE_USER, 'shareWith' => $user)); $shareWith[] = array('label' => $displayName, 'value' => array('shareType' => OCP\Share::SHARE_TYPE_USER, 'shareWith' => $uid));
$count++; $count++;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment