Skip to content

Commit

Permalink
Merge pull request #35137 from owncloud/release-10.2.0-fixup-35089
Browse files Browse the repository at this point in the history
[10.2.0] Set mail_send via old share API
  • Loading branch information
Vincent Petry authored May 2, 2019
2 parents b4ca957 + 73b6d92 commit 8597b07
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions apps/files_sharing/lib/Controller/Share20OcsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -920,12 +920,13 @@ public function declineShare($id) {
* @NoAdminRequired
*
* @param int $itemSource
* @param string $itemType
* @param int $shareType
* @param string $recipient
*
* @return Result
*/
public function notifyRecipients($itemSource, $shareType, $recipient) {
public function notifyRecipients($itemSource, $itemType, $shareType, $recipient) {
$recipientList = [];
if ($shareType === Share::SHARE_TYPE_USER) {
$recipientList[] = $this->userManager->get($recipient);
Expand Down Expand Up @@ -960,12 +961,8 @@ public function notifyRecipients($itemSource, $shareType, $recipient) {
// if we were able to send to at least one recipient, mark as sent
// allowing the user to resend would spam users who already got a notification
if (\count($result) < \count($recipientList)) {
$items = $this->shareManager->getSharedWith($recipient, $shareType, $node);
if (\count($items) > 0) {
$share = $items[0];
$share->setMailSend(true);
$this->shareManager->updateShare($share);
}
// FIXME: migrate to a new share API
Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, true);
}

$message = empty($result)
Expand All @@ -984,22 +981,15 @@ public function notifyRecipients($itemSource, $shareType, $recipient) {
* @NoAdminRequired
*
* @param int $itemSource
* @param string $itemType
* @param int $shareType
* @param string $recipient
*
* @return Result
*/
public function notifyRecipientsDisabled($itemSource, $shareType, $recipient) {
$userFolder = $this->rootFolder->getUserFolder($this->currentUser->getUID());
$nodes = $userFolder->getById($itemSource, true);
$node = $nodes[0] ?? null;

$items = $this->shareManager->getSharedWith($recipient, $shareType, $node);
if (\count($items) > 0) {
$share = $items[0];
$share->setMailSend(true);
$this->shareManager->updateShare($share);
}
public function notifyRecipientsDisabled($itemSource, $itemType, $shareType, $recipient) {
// FIXME: migrate to a new share API
Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, true);
return new Result();
}

Expand Down

0 comments on commit 8597b07

Please sign in to comment.