summaryrefslogtreecommitdiffstats
path: root/apps/twofactor_backupcodes
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-07-07 11:05:00 +0200
committerGitHub <noreply@github.com>2017-07-07 11:05:00 +0200
commitb4deba207856e92adfbf7239ea7d2420157993dd (patch)
tree22bc71158a91e74e1d28c639c0801a735a78db76 /apps/twofactor_backupcodes
parentb1520a645833c2047103a2cf550f5c21b1c25586 (diff)
parentca3a6ec6077e4248d56550b1acb19ab72546e808 (diff)
downloadnextcloud-server-b4deba207856e92adfbf7239ea7d2420157993dd.tar.gz
nextcloud-server-b4deba207856e92adfbf7239ea7d2420157993dd.zip
Merge pull request #5483 from nextcloud/issue-5075-png-files-for-activity-emails
Use PNGs for icons in activity emails
Diffstat (limited to 'apps/twofactor_backupcodes')
-rw-r--r--apps/twofactor_backupcodes/lib/Activity/Provider.php19
-rw-r--r--apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php12
2 files changed, 18 insertions, 13 deletions
diff --git a/apps/twofactor_backupcodes/lib/Activity/Provider.php b/apps/twofactor_backupcodes/lib/Activity/Provider.php
index 9c7aaeae630..739ac9bbe13 100644
--- a/apps/twofactor_backupcodes/lib/Activity/Provider.php
+++ b/apps/twofactor_backupcodes/lib/Activity/Provider.php
@@ -24,8 +24,8 @@ namespace OCA\TwoFactorBackupCodes\Activity;
use InvalidArgumentException;
use OCP\Activity\IEvent;
+use OCP\Activity\IManager;
use OCP\Activity\IProvider;
-use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\L10N\IFactory as L10nFactory;
@@ -37,17 +37,17 @@ class Provider implements IProvider {
/** @var IURLGenerator */
private $urlGenerator;
- /** @var ILogger */
- private $logger;
+ /** @var IManager */
+ private $activityManager;
/**
* @param L10nFactory $l10n
* @param IURLGenerator $urlGenerator
- * @param ILogger $logger
+ * @param IManager $activityManager
*/
- public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, ILogger $logger) {
- $this->logger = $logger;
+ public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) {
$this->urlGenerator = $urlGenerator;
+ $this->activityManager = $activityManager;
$this->l10n = $l10n;
}
@@ -61,7 +61,12 @@ class Provider implements IProvider {
switch ($event->getSubject()) {
case 'codes_generated':
$event->setParsedSubject($l->t('You created two-factor backup codes for your account'));
- $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
+
+ if ($this->activityManager->getRequirePNG()) {
+ $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
+ } else {
+ $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
+ }
break;
default:
throw new InvalidArgumentException();
diff --git a/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php b/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php
index e1a13c89c10..a56098556e5 100644
--- a/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/Activity/ProviderTest.php
@@ -25,8 +25,8 @@ namespace OCA\TwoFactorBackupCodes\Test\Unit\Activity;
use InvalidArgumentException;
use OCA\TwoFactorBackupCodes\Activity\Provider;
use OCP\Activity\IEvent;
+use OCP\Activity\IManager;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
use PHPUnit_Framework_MockObject_MockObject;
@@ -34,14 +34,14 @@ use Test\TestCase;
class ProviderTest extends TestCase {
- /** @var IL10N|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IFactory|PHPUnit_Framework_MockObject_MockObject */
private $l10n;
/** @var IURLGenerator|PHPUnit_Framework_MockObject_MockObject */
private $urlGenerator;
- /** @var ILogger|PHPUnit_Framework_MockObject_MockObject */
- private $logger;
+ /** @var IManager|PHPUnit_Framework_MockObject_MockObject */
+ private $activityManager;
/** @var Provider */
private $provider;
@@ -51,9 +51,9 @@ class ProviderTest extends TestCase {
$this->l10n = $this->createMock(IFactory::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->activityManager = $this->createMock(IManager::class);
- $this->provider = new Provider($this->l10n, $this->urlGenerator, $this->logger);
+ $this->provider = new Provider($this->l10n, $this->urlGenerator, $this->activityManager);
}
public function testParseUnrelated() {