Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ protected function createMailShare(IShare $share) {
$share->getToken(),
$share->getPassword(),
$share->getSendPasswordByTalk(),
$share->getHideDownload()
$share->getHideDownload(),
$share->getExpirationDate()
);

try {
Expand Down Expand Up @@ -649,9 +650,10 @@ public function getChildren(IShare $parent) {
* @param string $password
* @param bool $sendPasswordByTalk
* @param bool $hideDownload
* @param \DateTime|null $expirationTime
* @return int
*/
protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload) {
protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload, $expirationTime) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->insert('share')
->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL))
Expand All @@ -668,6 +670,10 @@ protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $
->setValue('stime', $qb->createNamedParameter(time()))
->setValue('hide_download', $qb->createNamedParameter((int)$hideDownload, IQueryBuilder::PARAM_INT));

if ($expirationTime !== null) {
$qb->setValue('expiration', $qb->createNamedParameter($expirationTime, IQueryBuilder::PARAM_DATE));
}

/*
* Added to fix https://github.com/owncloud/core/issues/22215
* Can be removed once we get rid of ajax/share.php
Expand Down
5 changes: 4 additions & 1 deletion apps/sharebymail/tests/ShareByMailProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ public function testAddShareToDB() {
$password = 'password';
$sendPasswordByTalk = true;
$hideDownload = true;
$expiration = new \DateTime();


$instance = $this->getInstance();
Expand All @@ -540,7 +541,8 @@ public function testAddShareToDB() {
$token,
$password,
$sendPasswordByTalk,
$hideDownload
$hideDownload,
$expiration
]
);

Expand All @@ -565,6 +567,7 @@ public function testAddShareToDB() {
$this->assertSame($password, $result[0]['password']);
$this->assertSame($sendPasswordByTalk, (bool)$result[0]['password_by_talk']);
$this->assertSame($hideDownload, (bool)$result[0]['hide_download']);
$this->assertSame($expiration->getTimestamp(), \DateTime::createFromFormat('Y-m-d H:i:s', $result[0]['expiration'])->getTimestamp());
}

public function testUpdate() {
Expand Down