From f00ab8bbc065dfbe03a65c8ef4f89d6ac227f6f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 27 Aug 2019 08:09:25 +0200 Subject: [PATCH 1/2] Use custom client URL in welcome emails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- settings/Mailer/NewUserMailHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/Mailer/NewUserMailHelper.php b/settings/Mailer/NewUserMailHelper.php index fd447c48f0..b597450929 100644 --- a/settings/Mailer/NewUserMailHelper.php +++ b/settings/Mailer/NewUserMailHelper.php @@ -148,7 +148,7 @@ class NewUserMailHelper { $leftButtonText, $link, $l10n->t('Install Client'), - 'https://nextcloud.com/install/#install-clients' + $this->config->getSystemValue('customclient_desktop', 'https://nextcloud.com/install/#install-clients') ); $emailTemplate->addFooter(); From 52dc36fb88a1255be5d8593976b502728d1bd82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 27 Aug 2019 10:22:54 +0200 Subject: [PATCH 2/2] Mock client URL in new user mail tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- tests/Settings/Mailer/NewUserMailHelperTest.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/Settings/Mailer/NewUserMailHelperTest.php b/tests/Settings/Mailer/NewUserMailHelperTest.php index f29da7fbfd..0e7bc395f2 100644 --- a/tests/Settings/Mailer/NewUserMailHelperTest.php +++ b/tests/Settings/Mailer/NewUserMailHelperTest.php @@ -79,6 +79,18 @@ class NewUserMailHelperTest extends TestCase { $this->secureRandom = $this->createMock(ISecureRandom::class); $this->timeFactory = $this->createMock(ITimeFactory::class); $this->config = $this->createMock(IConfig::class); + $this->config + ->expects($this->any()) + ->method('getSystemValue') + ->willReturnCallback(function($arg) { + switch ($arg) { + case 'secret': + return 'MyInstanceWideSecret'; + case 'customclient_desktop': + return 'https://nextcloud.com/install/#install-clients'; + } + return ''; + }); $this->crypto = $this->createMock(ICrypto::class); $this->l10n->method('t') ->will($this->returnCallback(function ($text, $parameters = []) { @@ -122,11 +134,6 @@ class NewUserMailHelperTest extends TestCase { ->expects($this->any()) ->method('getEmailAddress') ->willReturn('recipient@example.com'); - $this->config - ->expects($this->any()) - ->method('getSystemValue') - ->with('secret') - ->willReturn('MyInstanceWideSecret'); $this->crypto ->expects($this->once()) ->method('encrypt')