Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2017-12-12 20:21:58 +0300
committerGitHub <noreply@github.com>2017-12-12 20:21:58 +0300
commitaa2a9acff82773f070d43e17d2142bde10e0e307 (patch)
tree545601660432ec3f6297cb52294863722b8841fe
parent700c9dd864039d380b59bcb4b52db418afb5c227 (diff)
parentca65804fd2de06f2e6502c03c7ca361932c7fef2 (diff)
Merge pull request #524 from nextcloud/update-call-provider
Update contacts menu call provider.
-rw-r--r--lib/ContactsMenu/Providers/CallProvider.php18
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);
}