summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/ocs/cloud.php8
-rw-r--r--lib/private/share/mailnotifications.php38
-rw-r--r--lib/private/user/user.php2
3 files changed, 27 insertions, 21 deletions
diff --git a/lib/private/ocs/cloud.php b/lib/private/ocs/cloud.php
index 0d93819b9e4..2cf40c449ff 100644
--- a/lib/private/ocs/cloud.php
+++ b/lib/private/ocs/cloud.php
@@ -41,11 +41,11 @@ class OC_OCS_Cloud {
}
public static function getCurrentUser() {
- $email=\OC::$server->getConfig()->getUserValue(OC_User::getUser(), 'settings', 'email', '');
+ $userObject = \OC::$server->getUserManager()->get(OC_User::getUser());
$data = array(
- 'id' => OC_User::getUser(),
- 'display-name' => OC_User::getDisplayName(),
- 'email' => $email,
+ 'id' => $userObject->getUID(),
+ 'display-name' => $userObject->getDisplayName(),
+ 'email' => $userObject->getEMailAddress(),
);
return new OC_OCS_Result($data);
}
diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php
index 2797e5ed99b..c7747fd38c1 100644
--- a/lib/private/share/mailnotifications.php
+++ b/lib/private/share/mailnotifications.php
@@ -28,11 +28,12 @@
namespace OC\Share;
use DateTime;
-use OCP\IConfig;
use OCP\IL10N;
+use OCP\IUser;
use OCP\Mail\IMailer;
use OCP\ILogger;
use OCP\Defaults;
+use OCP\Util;
/**
* Class MailNotifications
@@ -41,16 +42,14 @@ use OCP\Defaults;
*/
class MailNotifications {
- /** @var string sender userId */
- private $userId;
+ /** @var IUser sender userId */
+ private $user;
/** @var string sender email address */
private $replyTo;
/** @var string */
private $senderDisplayName;
/** @var IL10N */
private $l;
- /** @var IConfig */
- private $config;
/** @var IMailer */
private $mailer;
/** @var Defaults */
@@ -59,34 +58,31 @@ class MailNotifications {
private $logger;
/**
- * @param string $uid user id
- * @param IConfig $config
+ * @param IUser $user
* @param IL10N $l10n
* @param IMailer $mailer
* @param ILogger $logger
* @param Defaults $defaults
*/
- public function __construct($uid,
- IConfig $config,
+ public function __construct(IUser $user,
IL10N $l10n,
IMailer $mailer,
ILogger $logger,
Defaults $defaults) {
$this->l = $l10n;
- $this->userId = $uid;
- $this->config = $config;
+ $this->user = $user;
$this->mailer = $mailer;
$this->logger = $logger;
$this->defaults = $defaults;
- $this->replyTo = $this->config->getUserValue($this->userId, 'settings', 'email', null);
- $this->senderDisplayName = \OCP\User::getDisplayName($this->userId);
+ $this->replyTo = $this->user->getEMailAddress();
+ $this->senderDisplayName = $this->user->getDisplayName();
}
/**
* inform users if a file was shared with them
*
- * @param array $recipientList list of recipients
+ * @param IUser[] $recipientList list of recipients
* @param string $itemSource shared item source
* @param string $itemType shared item type
* @return array list of user to whom the mail send operation failed
@@ -95,8 +91,8 @@ class MailNotifications {
$noMail = [];
foreach ($recipientList as $recipient) {
- $recipientDisplayName = \OCP\User::getDisplayName($recipient);
- $to = $this->config->getUserValue($recipient, 'settings', 'email', '');
+ $recipientDisplayName = $recipient->getDisplayName();
+ $to = $recipient->getEMailAddress();
if ($to === '') {
$noMail[] = $recipientDisplayName;
@@ -233,4 +229,14 @@ class MailNotifications {
return [$htmlMail, $plainTextMail];
}
+ /**
+ * @param $itemSource
+ * @param $itemType
+ * @param IUser $recipient
+ * @return array
+ */
+ protected function getItemSharedWithUser($itemSource, $itemType, $recipient) {
+ return Share::getItemSharedWithUser($itemType, $itemSource, $recipient->getUID());
+ }
+
}
diff --git a/lib/private/user/user.php b/lib/private/user/user.php
index d1fa641504c..d827097ee39 100644
--- a/lib/private/user/user.php
+++ b/lib/private/user/user.php
@@ -312,7 +312,7 @@ class User implements IUser {
* @since 9.0.0
*/
public function getEMailAddress() {
- return $this->config->getUserValue($this->uid, 'settings', 'email');
+ return $this->config->getUserValue($this->uid, 'settings', 'email', null);
}
/**