diff options
author | Ivan Sein <ivan@struktur.de> | 2017-12-12 19:57:29 +0300 |
---|---|---|
committer | Ivan Sein <ivan@struktur.de> | 2017-12-12 19:57:29 +0300 |
commit | ca65804fd2de06f2e6502c03c7ca361932c7fef2 (patch) | |
tree | 545601660432ec3f6297cb52294863722b8841fe /lib/ContactsMenu | |
parent | 700c9dd864039d380b59bcb4b52db418afb5c227 (diff) |
Update contacts menu call provider.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
Diffstat (limited to 'lib/ContactsMenu')
-rw-r--r-- | lib/ContactsMenu/Providers/CallProvider.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/ContactsMenu/Providers/CallProvider.php b/lib/ContactsMenu/Providers/CallProvider.php index da5ebdb00..54b590928 100644 --- a/lib/ContactsMenu/Providers/CallProvider.php +++ b/lib/ContactsMenu/Providers/CallProvider.php @@ -29,6 +29,7 @@ use OCP\Contacts\ContactsMenu\IEntry; use OCP\Contacts\ContactsMenu\IProvider; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\IUserManager; class CallProvider implements IProvider { @@ -38,17 +39,22 @@ class CallProvider implements IProvider { /** @var IURLGenerator */ private $urlGenerator; + /** @var IUserManager */ + private $userManager; + /** @var IL10N */ private $l10n; /** * @param IActionFactory $actionFactory * @param IURLGenerator $urlGenerator + * @param IUserManager $userManager * @param IL10N $l10n */ - public function __construct(IActionFactory $actionFactory, IURLGenerator $urlGenerator, IL10N $l10n) { + public function __construct(IActionFactory $actionFactory, IURLGenerator $urlGenerator, IL10N $l10n, IUserManager $userManager) { $this->actionFactory = $actionFactory; $this->urlGenerator = $urlGenerator; + $this->userManager = $userManager; $this->l10n = $l10n; } @@ -57,6 +63,12 @@ class CallProvider implements IProvider { */ public function process(IEntry $entry) { $uid = $entry->getProperty('UID'); + $user = $this->userManager->get($uid); + $talkAction = $this->l10n->t('Talk'); + + if ($user !== null) { + $talkAction = $this->l10n->t('Talk to %s', [$user->getDisplayName()]); + } if ($uid === null) { // Nothing to do @@ -68,9 +80,9 @@ class CallProvider implements IProvider { return; } - $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/video.svg')); + $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('spreed', 'app-dark.svg')); $callUrl = $this->urlGenerator->linkToRouteAbsolute('spreed.Page.index') . '?callUser=' . $uid; - $action = $this->actionFactory->newLinkAction($iconUrl, $this->l10n->t('Video call'), $callUrl); + $action = $this->actionFactory->newLinkAction($iconUrl, $talkAction, $callUrl); $entry->addAction($action); } |