diff --git a/core/js/contactsmenu.js b/core/js/contactsmenu.js
index bf469b8a32..2e33b5e7c6 100644
--- a/core/js/contactsmenu.js
+++ b/core/js/contactsmenu.js
@@ -58,7 +58,9 @@
+ '
{{contact.lastMessage}}
'
+ ''
+ '{{#if contact.topAction}}'
- + ''
+ + ''
+ + ' '
+ + ''
+ '{{/if}}'
+ '{{#if contact.hasManyActions}}'
+ ' '
@@ -67,7 +69,7 @@
+ ' {{#each contact.actions}}'
+ ' '
+ ' '
- + ' '
+ + ' '
+ ' {{title}}'
+ ' '
+ ' '
diff --git a/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php b/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php
index 18e7ad8cdd..d5630e6420 100644
--- a/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php
+++ b/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php
@@ -27,26 +27,32 @@ namespace OC\Contacts\ContactsMenu\Providers;
use OCP\Contacts\ContactsMenu\IActionFactory;
use OCP\Contacts\ContactsMenu\IEntry;
use OCP\Contacts\ContactsMenu\IProvider;
+use OCP\IURLGenerator;
class EMailProvider implements IProvider {
/** @var IActionFactory */
private $actionFactory;
+ /** @var IURLGenerator */
+ private $urlGenerator;
+
/**
* @param IActionFactory $actionFactory
+ * @param IURLGenerator $urlGenerator
*/
- public function __construct(IActionFactory $actionFactory) {
+ public function __construct(IActionFactory $actionFactory, IURLGenerator $urlGenerator) {
$this->actionFactory = $actionFactory;
+ $this->urlGenerator = $urlGenerator;
}
/**
* @param IEntry $entry
*/
public function process(IEntry $entry) {
+ $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/mail.svg'));
foreach ($entry->getEMailAddresses() as $address) {
- // TODO: absolute path
- $action = $this->actionFactory->newEMailAction('icon-mail', $address, $address);
+ $action = $this->actionFactory->newEMailAction($iconUrl, $address, $address);
$entry->addAction($action);
}
}
diff --git a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
index af7b21a648..2d82fa5d68 100644
--- a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
+++ b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
@@ -28,6 +28,7 @@ use OC\Contacts\ContactsMenu\Providers\EMailProvider;
use OCP\Contacts\ContactsMenu\IActionFactory;
use OCP\Contacts\ContactsMenu\IEntry;
use OCP\Contacts\ContactsMenu\ILinkAction;
+use OCP\IURLGenerator;
use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
@@ -36,6 +37,9 @@ class EMailproviderTest extends TestCase {
/** @var IActionFactory|PHPUnit_Framework_MockObject_MockObject */
private $actionFactory;
+ /** @var IURLGenerator|PHPUnit_Framework_MockObject_MockObject */
+ private $urlGenerator;
+
/** @var EMailProvider */
private $provider;
@@ -43,13 +47,22 @@ class EMailproviderTest extends TestCase {
parent::setUp();
$this->actionFactory = $this->createMock(IActionFactory::class);
- $this->provider = new EMailProvider($this->actionFactory);
+ $this->urlGenerator = $this->createMock(IURLGenerator::class);
+
+ $this->provider = new EMailProvider($this->actionFactory, $this->urlGenerator);
}
public function testProcess() {
$entry = $this->createMock(IEntry::class);
$action = $this->createMock(ILinkAction::class);
-
+ $iconUrl = 'https://example.com/img/actions/icon.svg';
+ $this->urlGenerator->expects($this->once())
+ ->method('imagePath')
+ ->willReturn('img/actions/icon.svg');
+ $this->urlGenerator->expects($this->once())
+ ->method('getAbsoluteURL')
+ ->with('img/actions/icon.svg')
+ ->willReturn($iconUrl);
$entry->expects($this->once())
->method('getEMailAddresses')
->willReturn([
@@ -57,7 +70,7 @@ class EMailproviderTest extends TestCase {
]);
$this->actionFactory->expects($this->once())
->method('newEMailAction')
- ->with($this->equalTo('icon-mail'), $this->equalTo('Mail'), $this->equalTo('user@example.com'))
+ ->with($this->equalTo($iconUrl), $this->equalTo('user@example.com'), $this->equalTo('user@example.com'))
->willReturn($action);
$entry->expects($this->once())
->method('addAction')