Add support for `\OCP\Share\IShare::getMailSend` back
This adds back the support for `\OCP\Share\IShare::getMailSend`, one example is creating bulk shares via API which where previously blocking due to the share notification emails. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
655c0cb40d
commit
56a2512581
|
@ -837,7 +837,7 @@ class DefaultShareProvider implements IShareProvider {
|
||||||
->setShareType((int)$data['share_type'])
|
->setShareType((int)$data['share_type'])
|
||||||
->setPermissions((int)$data['permissions'])
|
->setPermissions((int)$data['permissions'])
|
||||||
->setTarget($data['file_target'])
|
->setTarget($data['file_target'])
|
||||||
->setMailSend((bool)$data['mail_send']);
|
->setMailSend(true);
|
||||||
|
|
||||||
$shareTime = new \DateTime();
|
$shareTime = new \DateTime();
|
||||||
$shareTime->setTimestamp((int)$data['stime']);
|
$shareTime->setTimestamp((int)$data['stime']);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue