summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php10
-rw-r--r--apps/sharebymail/tests/ShareByMailProviderTest.php5
2 files changed, 12 insertions, 3 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php
index 73e962e3292..d26938a3242 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -338,7 +338,8 @@ class ShareByMailProvider implements IShareProvider {
$share->getShareOwner(),
$share->getPermissions(),
$share->getToken(),
- $share->getPassword()
+ $share->getPassword(),
+ $share->getSendPasswordByTalk()
);
try {
@@ -660,9 +661,11 @@ class ShareByMailProvider implements IShareProvider {
* @param string $uidOwner
* @param int $permissions
* @param string $token
+ * @param string $password
+ * @param bool $sendPasswordByTalk
* @return int
*/
- protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password) {
+ protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->insert('share')
->setValue('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_EMAIL))
@@ -675,6 +678,7 @@ class ShareByMailProvider implements IShareProvider {
->setValue('permissions', $qb->createNamedParameter($permissions))
->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()));
/*
@@ -716,6 +720,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('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()))
->execute();
@@ -972,6 +977,7 @@ class ShareByMailProvider implements IShareProvider {
$share->setShareTime($shareTime);
$share->setSharedWith($data['share_with']);
$share->setPassword($data['password']);
+ $share->setSendPasswordByTalk($data['password_by_talk']);
if ($data['uid_initiator'] !== null) {
$share->setShareOwner($data['uid_owner']);
diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php
index f0d99e6026c..48b5de62146 100644
--- a/apps/sharebymail/tests/ShareByMailProviderTest.php
+++ b/apps/sharebymail/tests/ShareByMailProviderTest.php
@@ -296,6 +296,7 @@ class ShareByMailProviderTest extends TestCase {
$permissions = 1;
$token = 'token';
$password = 'password';
+ $sendPasswordByTalk = true;
$instance = $this->getInstance();
@@ -310,7 +311,8 @@ class ShareByMailProviderTest extends TestCase {
$uidOwner,
$permissions,
$token,
- $password
+ $password,
+ $sendPasswordByTalk
]
);
@@ -330,6 +332,7 @@ class ShareByMailProviderTest extends TestCase {
$this->assertSame($permissions, (int)$result[0]['permissions']);
$this->assertSame($token, $result[0]['token']);
$this->assertSame($password, $result[0]['password']);
+ $this->assertSame($sendPasswordByTalk, (bool)$result[0]['password_by_talk']);
}