summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2021-11-04 08:37:26 +0100
committerGitHub <noreply@github.com>2021-11-04 08:37:26 +0100
commitf376af6421ce1c71df1407cbabcb0212a28112b0 (patch)
treed1418b8f94aa3906c6f420aa188bd6f95e8cdf1f
parent9b1eab25ce0ad9bfa966383c07586645c3049a7b (diff)
parent34029fe3c9113d92a16399a0d390eac551c5a27e (diff)
downloadnextcloud-server-f376af6421ce1c71df1407cbabcb0212a28112b0.tar.gz
nextcloud-server-f376af6421ce1c71df1407cbabcb0212a28112b0.zip
Merge pull request #29534 from nextcloud/backport/29332/stable22
-rw-r--r--apps/sharebymail/lib/Capabilities.php9
-rw-r--r--apps/sharebymail/tests/CapabilitiesTest.php10
2 files changed, 17 insertions, 2 deletions
diff --git a/apps/sharebymail/lib/Capabilities.php b/apps/sharebymail/lib/Capabilities.php
index eda8df9db5e..39d7172bb76 100644
--- a/apps/sharebymail/lib/Capabilities.php
+++ b/apps/sharebymail/lib/Capabilities.php
@@ -27,6 +27,7 @@ declare(strict_types=1);
*/
namespace OCA\ShareByMail;
+use OCA\ShareByMail\Settings\SettingsManager;
use OCP\Capabilities\ICapability;
use OCP\Share\IManager;
@@ -35,8 +36,13 @@ class Capabilities implements ICapability {
/** @var IManager */
private $manager;
- public function __construct(IManager $manager) {
+ /** @var SettingsManager */
+ private $settingsManager;
+
+ public function __construct(IManager $manager,
+ SettingsManager $settingsManager) {
$this->manager = $manager;
+ $this->settingsManager = $settingsManager;
}
public function getCapabilities(): array {
@@ -46,6 +52,7 @@ class Capabilities implements ICapability {
'sharebymail' =>
[
'enabled' => $this->manager->shareApiAllowLinks(),
+ 'send_password_by_mail' => $this->settingsManager->sendPasswordByMail(),
'upload_files_drop' => [
'enabled' => true,
],
diff --git a/apps/sharebymail/tests/CapabilitiesTest.php b/apps/sharebymail/tests/CapabilitiesTest.php
index 35b6bb6a919..19e91ab51e4 100644
--- a/apps/sharebymail/tests/CapabilitiesTest.php
+++ b/apps/sharebymail/tests/CapabilitiesTest.php
@@ -26,6 +26,7 @@
namespace OCA\ShareByMail\Tests;
use OCA\ShareByMail\Capabilities;
+use OCA\ShareByMail\Settings\SettingsManager;
use OCP\Share\IManager;
use Test\TestCase;
@@ -36,12 +37,16 @@ class CapabilitiesTest extends TestCase {
/** @var IManager | \PHPUnit\Framework\MockObject\MockObject */
private $manager;
+ /** @var IManager | \PHPUnit\Framework\MockObject\MockObject */
+ private $settingsManager;
+
protected function setUp(): void {
parent::setUp();
$this->manager = $this::createMock(IManager::class);
- $this->capabilities = new Capabilities($this->manager);
+ $this->settingsManager = $this::createMock(SettingsManager::class);
+ $this->capabilities = new Capabilities($this->manager, $this->settingsManager);
}
public function testGetCapabilities() {
@@ -51,6 +56,8 @@ class CapabilitiesTest extends TestCase {
->willReturn(false);
$this->manager->method('shareApiLinkDefaultExpireDateEnforced')
->willReturn(false);
+ $this->settingsManager->method('sendPasswordByMail')
+ ->willReturn(true);
$capabilities = [
'files_sharing' =>
@@ -58,6 +65,7 @@ class CapabilitiesTest extends TestCase {
'sharebymail' =>
[
'enabled' => true,
+ 'send_password_by_mail' => true,
'upload_files_drop' => [
'enabled' => true,
],