Merge pull request #6437 from nextcloud/support-mail-send-in-share

Add support for `\OCP\Share\IShare::getMailSend` back
This commit is contained in:
Morris Jobke 2017-11-27 11:29:38 +01:00 committed by GitHub
commit 4b73ddc9ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 18 deletions

View File

@ -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 |

View File

@ -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;
} }

View File

@ -669,6 +669,8 @@ 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) {
$mailSend = $share->getMailSend();
if($mailSend === true) {
$user = $this->userManager->get($share->getSharedWith()); $user = $this->userManager->get($share->getSharedWith());
if ($user !== null) { if ($user !== null) {
$emailAddress = $user->getEMailAddress(); $emailAddress = $user->getEMailAddress();
@ -690,6 +692,9 @@ class Manager implements IManager {
} 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 to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']);
} }
} else {
$this->logger->debug('Share notification not send because mailsend is false.', ['app' => 'share']);
}
} }
return $share; return $share;