Skip to content

Commit

Permalink
Properly respect hide download on sharebymail
Browse files Browse the repository at this point in the history
fixes #19484

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Mar 12, 2020
1 parent dbead0c commit b004d2e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ protected function createMailShare(IShare $share) {
$share->getPermissions(),
$share->getToken(),
$share->getPassword(),
$share->getSendPasswordByTalk()
$share->getSendPasswordByTalk(),
$share->getHideDownload()

This comment has been minimized.

Copy link
@skjnldsv

skjnldsv Mar 12, 2020

Member

We should most likely just extend to the same as link share here too?

);

try {
Expand Down Expand Up @@ -686,9 +687,10 @@ public function getChildren(IShare $parent) {
* @param string $token
* @param string $password
* @param bool $sendPasswordByTalk
* @param bool $hideDownload
* @return int
*/
protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk) {
protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->insert('share')
->setValue('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_EMAIL))
Expand All @@ -702,7 +704,8 @@ protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $
->setValue('token', $qb->createNamedParameter($token))
->setValue('password', $qb->createNamedParameter($password))
->setValue('password_by_talk', $qb->createNamedParameter($sendPasswordByTalk, IQueryBuilder::PARAM_BOOL))
->setValue('stime', $qb->createNamedParameter(time()));
->setValue('stime', $qb->createNamedParameter(time()))
->setValue('hide_download', $qb->createNamedParameter($hideDownload, IQueryBuilder::PARAM_BOOL));

/*
* Added to fix https://github.com/owncloud/core/issues/22215
Expand Down Expand Up @@ -747,6 +750,7 @@ public function update(IShare $share, $plainTextPassword = null) {
->set('password_by_talk', $qb->createNamedParameter($share->getSendPasswordByTalk(), IQueryBuilder::PARAM_BOOL))
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
->set('note', $qb->createNamedParameter($share->getNote()))
->set('hide_download', $qb->createNamedParameter($share->getHideDownload(), IQueryBuilder::PARAM_BOOL))
->execute();

if ($originalShare->getNote() !== $share->getNote() && $share->getNote() !== '') {
Expand Down Expand Up @@ -1007,6 +1011,7 @@ protected function createShareObject($data) {
$share->setSharedWith($data['share_with']);
$share->setPassword($data['password']);
$share->setSendPasswordByTalk((bool)$data['password_by_talk']);
$share->setHideDownload((bool)$data['hide_download']);

if ($data['uid_initiator'] !== null) {
$share->setShareOwner($data['uid_owner']);
Expand Down

0 comments on commit b004d2e

Please sign in to comment.