summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-11-27 11:29:38 +0100
committerGitHub <noreply@github.com>2017-11-27 11:29:38 +0100
commit4b73ddc9cec0a084389ca813ecfb42c15b2d38fe (patch)
treeee0fff117ee88646e652128f6063db425a2d0799 /lib
parent3d7489cfd6d3b0d85b1cc3d9e23abfcf180567db (diff)
parenta51a8fbcafe0005f32d526df2facc01c216b79b6 (diff)
downloadnextcloud-server-4b73ddc9cec0a084389ca813ecfb42c15b2d38fe.tar.gz
nextcloud-server-4b73ddc9cec0a084389ca813ecfb42c15b2d38fe.zip
Merge pull request #6437 from nextcloud/support-mail-send-in-share
Add support for `\OCP\Share\IShare::getMailSend` back
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Share20/DefaultShareProvider.php3
-rw-r--r--lib/private/Share20/Manager.php39
2 files changed, 25 insertions, 17 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index a440c36406b..844b36b2994 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -183,6 +183,9 @@ class DefaultShareProvider implements IShareProvider {
throw new ShareNotFound();
}
+ $mailSendValue = $share->getMailSend();
+ $data['mail_send'] = ($mailSendValue === null) ? true : $mailSendValue;
+
$share = $this->createShare($data);
return $share;
}
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 83fe4ec0d19..b22bfbc3878 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -669,26 +669,31 @@ class Manager implements IManager {
$this->eventDispatcher->dispatch('OCP\Share::postShare', $event);
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
- $user = $this->userManager->get($share->getSharedWith());
- if ($user !== null) {
- $emailAddress = $user->getEMailAddress();
- if ($emailAddress !== null && $emailAddress !== '') {
- $userLang = $this->config->getUserValue($share->getSharedWith(), 'core', 'lang', null);
- $l = $this->l10nFactory->get('lib', $userLang);
- $this->sendMailNotification(
- $l,
- $share->getNode()->getName(),
- $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', [ 'fileid' => $share->getNode()->getId() ]),
- $share->getSharedBy(),
- $emailAddress,
- $share->getExpirationDate()
- );
- $this->logger->debug('Send share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']);
+ $mailSend = $share->getMailSend();
+ if($mailSend === true) {
+ $user = $this->userManager->get($share->getSharedWith());
+ if ($user !== null) {
+ $emailAddress = $user->getEMailAddress();
+ if ($emailAddress !== null && $emailAddress !== '') {
+ $userLang = $this->config->getUserValue($share->getSharedWith(), 'core', 'lang', null);
+ $l = $this->l10nFactory->get('lib', $userLang);
+ $this->sendMailNotification(
+ $l,
+ $share->getNode()->getName(),
+ $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $share->getNode()->getId()]),
+ $share->getSharedBy(),
+ $emailAddress,
+ $share->getExpirationDate()
+ );
+ $this->logger->debug('Send share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']);
+ } else {
+ $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']);
+ }
} else {
- $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']);
+ $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']);
}
} else {
- $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']);
+ $this->logger->debug('Share notification not send because mailsend is false.', ['app' => 'share']);
}
}