summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-01 12:05:40 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-12-02 21:25:05 +0100
commiteebe2b9c239a7f9e7e127f52ab4b9e97763b0149 (patch)
tree81d9d855b7b6e0d5fb387cd5e8c6092f17e21de3 /core/ajax
parentdf5872ec50a68de5d99bd6b5cf17ceb94f2ef833 (diff)
downloadnextcloud-server-eebe2b9c239a7f9e7e127f52ab4b9e97763b0149.tar.gz
nextcloud-server-eebe2b9c239a7f9e7e127f52ab4b9e97763b0149.zip
User IUser::getEMailAddress() all over the place
Diffstat (limited to 'core/ajax')
-rw-r--r--core/ajax/share.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index fd42a94de6e..e9bbef172af 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -35,6 +35,8 @@
*
*/
+use OCP\IUser;
+
OC_JSON::checkLoggedIn();
OCP\JSON::callCheck();
@@ -135,17 +137,23 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$itemSource = (string)$_POST['itemSource'];
$recipient = (string)$_POST['recipient'];
+ $userManager = \OC::$server->getUserManager();
+ $recipientList = [];
if($shareType === \OCP\Share::SHARE_TYPE_USER) {
- $recipientList[] = $recipient;
+ $recipientList[] = $userManager->get($recipient);
} elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) {
$recipientList = \OC_Group::usersInGroup($recipient);
+ $group = \OC::$server->getGroupManager()->get($recipient);
+ $recipientList = $group->searchUsers('');
}
// don't send a mail to the user who shared the file
- $recipientList = array_diff($recipientList, array(\OCP\User::getUser()));
+ $recipientList = array_filter($recipientList, function($user) {
+ /** @var IUser $user */
+ return $user->getUID() !== \OCP\User::getUser();
+ });
$mailNotification = new \OC\Share\MailNotifications(
- \OC::$server->getUserSession()->getUser()->getUID(),
- \OC::$server->getConfig(),
+ \OC::$server->getUserSession()->getUser(),
\OC::$server->getL10N('lib'),
\OC::$server->getMailer(),
\OC::$server->getLogger(),
@@ -183,8 +191,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$to_address = (string)$_POST['toaddress'];
$mailNotification = new \OC\Share\MailNotifications(
- \OC::$server->getUserSession()->getUser()->getUID(),
- \OC::$server->getConfig(),
+ \OC::$server->getUserSession()->getUser(),
\OC::$server->getL10N('lib'),
\OC::$server->getMailer(),
\OC::$server->getLogger(),
@@ -199,7 +206,6 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
} catch (Exception $e) {
\OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR);
}
-
}
$result = $mailNotification->sendLinkShareMail($to_address, $file, $link, $expiration);