From 100d5d9a4707dd7f5f6572d69dd55cb3d62b955f Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Tue, 20 Oct 2020 13:58:01 +0200 Subject: Add labels to mail shares MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now the email is shown on a second line if a label is set. Signed-off-by: John Molakvoæ (skjnldsv) --- apps/sharebymail/lib/ShareByMailProvider.php | 9 +++++++-- apps/sharebymail/tests/ShareByMailProviderTest.php | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'apps/sharebymail') diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 2484ccdd720..e1585955c62 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -322,6 +322,7 @@ class ShareByMailProvider implements IShareProvider { $share->getPassword(), $share->getSendPasswordByTalk(), $share->getHideDownload(), + $share->getLabel(), $share->getExpirationDate() ); @@ -659,10 +660,11 @@ class ShareByMailProvider implements IShareProvider { * @param string $password * @param bool $sendPasswordByTalk * @param bool $hideDownload + * @param string $label * @param \DateTime|null $expirationTime * @return int */ - protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload, $expirationTime) { + protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload, $label, $expirationTime) { $qb = $this->dbConnection->getQueryBuilder(); $qb->insert('share') ->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL)) @@ -677,7 +679,8 @@ class ShareByMailProvider implements IShareProvider { ->setValue('password', $qb->createNamedParameter($password)) ->setValue('password_by_talk', $qb->createNamedParameter($sendPasswordByTalk, IQueryBuilder::PARAM_BOOL)) ->setValue('stime', $qb->createNamedParameter(time())) - ->setValue('hide_download', $qb->createNamedParameter((int)$hideDownload, IQueryBuilder::PARAM_INT)); + ->setValue('hide_download', $qb->createNamedParameter((int)$hideDownload, IQueryBuilder::PARAM_INT)) + ->setValue('label', $qb->createNamedParameter($label)); if ($expirationTime !== null) { $qb->setValue('expiration', $qb->createNamedParameter($expirationTime, IQueryBuilder::PARAM_DATE)); @@ -720,6 +723,7 @@ class ShareByMailProvider implements IShareProvider { ->set('uid_owner', $qb->createNamedParameter($share->getShareOwner())) ->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy())) ->set('password', $qb->createNamedParameter($share->getPassword())) + ->set('label', $qb->createNamedParameter($share->getLabel())) ->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())) @@ -982,6 +986,7 @@ class ShareByMailProvider implements IShareProvider { $share->setShareTime($shareTime); $share->setSharedWith($data['share_with']); $share->setPassword($data['password']); + $share->setLabel($data['label']); $share->setSendPasswordByTalk((bool)$data['password_by_talk']); $share->setHideDownload((bool)$data['hide_download']); diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index fede0d225a2..bb6e7d0a353 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -524,6 +524,7 @@ class ShareByMailProviderTest extends TestCase { $password = 'password'; $sendPasswordByTalk = true; $hideDownload = true; + $label = 'label'; $expiration = new \DateTime(); @@ -542,6 +543,7 @@ class ShareByMailProviderTest extends TestCase { $password, $sendPasswordByTalk, $hideDownload, + $label, $expiration ] ); @@ -567,6 +569,7 @@ class ShareByMailProviderTest extends TestCase { $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($label, $result[0]['label']); $this->assertSame($expiration->getTimestamp(), \DateTime::createFromFormat('Y-m-d H:i:s', $result[0]['expiration'])->getTimestamp()); } -- cgit v1.2.3