summaryrefslogtreecommitdiffstats
path: root/lib/private/Share
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-10-22 13:43:39 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-10-26 20:52:41 +0200
commitb7046d390fb651e7f83b22a02ca35deefcaab6e9 (patch)
tree8f239966a84e848efa7ae94f0ca668ac3156d2db /lib/private/Share
parent57e61250ac6c59fe93c65a95bfd2cb081cd3c34f (diff)
downloadnextcloud-server-b7046d390fb651e7f83b22a02ca35deefcaab6e9.tar.gz
nextcloud-server-b7046d390fb651e7f83b22a02ca35deefcaab6e9.zip
Remove internal share mail function
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Share')
-rw-r--r--lib/private/Share/MailNotifications.php80
1 files changed, 0 insertions, 80 deletions
diff --git a/lib/private/Share/MailNotifications.php b/lib/private/Share/MailNotifications.php
index aaecd5353e5..1bbd365699c 100644
--- a/lib/private/Share/MailNotifications.php
+++ b/lib/private/Share/MailNotifications.php
@@ -89,75 +89,6 @@ class MailNotifications {
}
/**
- * inform users if a file was shared with them
- *
- * @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
- */
- public function sendInternalShareMail($recipientList, $itemSource, $itemType) {
- $noMail = [];
-
- foreach ($recipientList as $recipient) {
- $recipientDisplayName = $recipient->getDisplayName();
- $to = $recipient->getEMailAddress();
-
- if ($to === '') {
- $noMail[] = $recipientDisplayName;
- continue;
- }
-
- $items = $this->getItemSharedWithUser($itemSource, $itemType, $recipient);
- $filename = trim($items[0]['file_target'], '/');
- $subject = (string) $this->l->t('%s shared »%s« with you', array($this->senderDisplayName, $filename));
- $expiration = null;
- if (isset($items[0]['expiration'])) {
- try {
- $date = new DateTime($items[0]['expiration']);
- $expiration = $date->getTimestamp();
- } catch (\Exception $e) {
- $this->logger->error("Couldn't read date: ".$e->getMessage(), ['app' => 'sharing']);
- }
- }
-
- $link = $this->urlGenerator->linkToRouteAbsolute(
- 'files.viewcontroller.showFile',
- ['fileId' => $items[0]['item_source']]
- );
-
- list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration, 'internal');
-
- // send it out now
- try {
- $message = $this->mailer->createMessage();
- $message->setSubject($subject);
- $message->setTo([$to => $recipientDisplayName]);
- $message->setHtmlBody($htmlBody);
- $message->setPlainBody($textBody);
- $message->setFrom([
- Util::getDefaultEmailAddress('sharing-noreply') =>
- (string)$this->l->t('%s via %s', [
- $this->senderDisplayName,
- $this->defaults->getName()
- ]),
- ]);
- if(!is_null($this->replyTo)) {
- $message->setReplyTo([$this->replyTo]);
- }
-
- $this->mailer->send($message);
- } catch (\Exception $e) {
- $this->logger->error("Can't send mail to inform the user about an internal share: ".$e->getMessage(), ['app' => 'sharing']);
- $noMail[] = $recipientDisplayName;
- }
- }
-
- return $noMail;
-
- }
-
- /**
* inform recipient about public link share
*
* @param string $recipient recipient email address
@@ -224,15 +155,4 @@ class MailNotifications {
return [$htmlMail, $plainTextMail];
}
-
- /**
- * @param string $itemSource
- * @param string $itemType
- * @param IUser $recipient
- * @return array
- */
- protected function getItemSharedWithUser($itemSource, $itemType, $recipient) {
- return Share::getItemSharedWithUser($itemType, $itemSource, $recipient->getUID());
- }
-
}