diff options
Diffstat (limited to 'lib/ContactsMenu/Providers/CallProvider.php')
-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); } |