Skip to content

Commit

Permalink
Merge pull request #11875 from nextcloud/add-support-for-sending-the-…
Browse files Browse the repository at this point in the history
…password-for-a-link-share-by-nextcloud-talk

Add support for sending the password for a link share by Nextcloud Talk
  • Loading branch information
rullzer authored Nov 2, 2018
2 parents 337cd25 + f57b07e commit 30a1237
Show file tree
Hide file tree
Showing 12 changed files with 761 additions and 28 deletions.
20 changes: 20 additions & 0 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ protected function formatShare(\OCP\Share\IShare $share, Node $recipientNode = n
$result['share_with'] = $share->getPassword();
$result['share_with_displayname'] = $share->getPassword();

$result['send_password_by_talk'] = $share->getSendPasswordByTalk();

$result['token'] = $share->getToken();
$result['url'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.showShare', ['token' => $share->getToken()]);

Expand Down Expand Up @@ -477,10 +479,19 @@ public function createShare(
$share->setPassword($password);
}


if (!empty($label)) {
$share->setLabel($label);
}

if ($sendPasswordByTalk === 'true') {
if (!$this->appManager->isEnabledForUser('spreed')) {
throw new OCSForbiddenException($this->l->t('Sharing %s sending the password by Nextcloud Talk failed because Nextcloud Talk is not enabled', [$path->getPath()]));
}

$share->setSendPasswordByTalk(true);
}

//Expire date
if ($expireDate !== '') {
try {
Expand Down Expand Up @@ -873,6 +884,15 @@ public function updateShare(
$share->setLabel($label);
}

if ($sendPasswordByTalk === 'true') {
if (!$this->appManager->isEnabledForUser('spreed')) {
throw new OCSForbiddenException($this->l->t('Sharing sending the password by Nextcloud Talk failed because Nextcloud Talk is not enabled'));
}

$share->setSendPasswordByTalk(true);
} else if ($sendPasswordByTalk !== null) {
$share->setSendPasswordByTalk(false);
}
} else {
if ($permissions !== null) {
$permissions = (int)$permissions;
Expand Down
Loading

0 comments on commit 30a1237

Please sign in to comment.