Merge pull request #6437 from nextcloud/support-mail-send-in-share
Add support for `\OCP\Share\IShare::getMailSend` back
This commit is contained in:
commit
4b73ddc9ce
|
@ -113,7 +113,7 @@ Feature: federated
|
||||||
| permissions | 19 |
|
| permissions | 19 |
|
||||||
| stime | A_NUMBER |
|
| stime | A_NUMBER |
|
||||||
| storage | A_NUMBER |
|
| storage | A_NUMBER |
|
||||||
| mail_send | 0 |
|
| mail_send | 1 |
|
||||||
| uid_owner | user1 |
|
| uid_owner | user1 |
|
||||||
| file_parent | A_NUMBER |
|
| file_parent | A_NUMBER |
|
||||||
| displayname_owner | user1 |
|
| displayname_owner | user1 |
|
||||||
|
|
|
@ -183,6 +183,9 @@ class DefaultShareProvider implements IShareProvider {
|
||||||
throw new ShareNotFound();
|
throw new ShareNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mailSendValue = $share->getMailSend();
|
||||||
|
$data['mail_send'] = ($mailSendValue === null) ? true : $mailSendValue;
|
||||||
|
|
||||||
$share = $this->createShare($data);
|
$share = $this->createShare($data);
|
||||||
return $share;
|
return $share;
|
||||||
}
|
}
|
||||||
|
|
|
@ -669,26 +669,31 @@ class Manager implements IManager {
|
||||||
$this->eventDispatcher->dispatch('OCP\Share::postShare', $event);
|
$this->eventDispatcher->dispatch('OCP\Share::postShare', $event);
|
||||||
|
|
||||||
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
|
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
|
||||||
$user = $this->userManager->get($share->getSharedWith());
|
$mailSend = $share->getMailSend();
|
||||||
if ($user !== null) {
|
if($mailSend === true) {
|
||||||
$emailAddress = $user->getEMailAddress();
|
$user = $this->userManager->get($share->getSharedWith());
|
||||||
if ($emailAddress !== null && $emailAddress !== '') {
|
if ($user !== null) {
|
||||||
$userLang = $this->config->getUserValue($share->getSharedWith(), 'core', 'lang', null);
|
$emailAddress = $user->getEMailAddress();
|
||||||
$l = $this->l10nFactory->get('lib', $userLang);
|
if ($emailAddress !== null && $emailAddress !== '') {
|
||||||
$this->sendMailNotification(
|
$userLang = $this->config->getUserValue($share->getSharedWith(), 'core', 'lang', null);
|
||||||
$l,
|
$l = $this->l10nFactory->get('lib', $userLang);
|
||||||
$share->getNode()->getName(),
|
$this->sendMailNotification(
|
||||||
$this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', [ 'fileid' => $share->getNode()->getId() ]),
|
$l,
|
||||||
$share->getSharedBy(),
|
$share->getNode()->getName(),
|
||||||
$emailAddress,
|
$this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $share->getNode()->getId()]),
|
||||||
$share->getExpirationDate()
|
$share->getSharedBy(),
|
||||||
);
|
$emailAddress,
|
||||||
$this->logger->debug('Send share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']);
|
$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 {
|
} 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 {
|
} 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']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue