diff options
author | Georg Ehrke <developer@georgehrke.com> | 2019-11-27 11:54:42 +0100 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2019-11-29 07:48:30 +0100 |
commit | 6d39c6cb507293577b43076d896ba4942b56d0f8 (patch) | |
tree | 3005fed255e21b4413d24ae2e784d592a0635fd8 /apps/dav/lib/CalDAV | |
parent | 73472725e6d2e189619b2882df8deec796f1bfe1 (diff) | |
download | nextcloud-server-6d39c6cb507293577b43076d896ba4942b56d0f8.tar.gz nextcloud-server-6d39c6cb507293577b43076d896ba4942b56d0f8.zip |
Set common-name to user's displayname if none is set
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib/CalDAV')
-rw-r--r-- | apps/dav/lib/CalDAV/Schedule/IMipPlugin.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index f4a233a0f06..b85e5613cfe 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -33,6 +33,7 @@ use OCP\IDBConnection; use OCP\IL10N; use OCP\ILogger; use OCP\IURLGenerator; +use OCP\IUserManager; use OCP\L10N\IFactory as L10NFactory; use OCP\Mail\IEMailTemplate; use OCP\Mail\IMailer; @@ -92,6 +93,9 @@ class IMipPlugin extends SabreIMipPlugin { /** @var Defaults */ private $defaults; + /** @var IUserManager */ + private $userManager; + const MAX_DATE = '2038-01-01'; const METHOD_REQUEST = 'request'; @@ -113,7 +117,8 @@ class IMipPlugin extends SabreIMipPlugin { public function __construct(IConfig $config, IMailer $mailer, ILogger $logger, ITimeFactory $timeFactory, L10NFactory $l10nFactory, IURLGenerator $urlGenerator, Defaults $defaults, - ISecureRandom $random, IDBConnection $db, $userId) { + ISecureRandom $random, IDBConnection $db, IUserManager $userManager, + $userId) { parent::__construct(''); $this->userId = $userId; $this->config = $config; @@ -125,6 +130,7 @@ class IMipPlugin extends SabreIMipPlugin { $this->random = $random; $this->db = $db; $this->defaults = $defaults; + $this->userManager = $userManager; } /** @@ -168,6 +174,15 @@ class IMipPlugin extends SabreIMipPlugin { $senderName = $iTipMessage->senderName ?: null; $recipientName = $iTipMessage->recipientName ?: null; + if ($senderName === null || empty(trim($senderName))) { + $user = $this->userManager->get($this->userId); + if ($user) { + // getDisplayName automatically uses the uid + // if no display-name is set + $senderName = $user->getDisplayName(); + } + } + /** @var VEvent $vevent */ $vevent = $iTipMessage->message->VEVENT; |