diff options
author | Joas Schilling <coding@schilljs.com> | 2020-03-17 15:39:26 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-04-07 10:31:52 +0300 |
commit | de5c1b9b82631a5a3ab1ef5386ec3026c5b69c6e (patch) | |
tree | dae45ca2318ed3b00887775b7fde164777bd487f /lib/ContactsMenu/Providers | |
parent | 1c47f9ff6287e1286e132d4a5b182120a65870cc (diff) |
Limit creating public and group conversations to a group
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/ContactsMenu/Providers')
-rw-r--r-- | lib/ContactsMenu/Providers/CallProvider.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/ContactsMenu/Providers/CallProvider.php b/lib/ContactsMenu/Providers/CallProvider.php index 7e46f6c33..569fa2bec 100644 --- a/lib/ContactsMenu/Providers/CallProvider.php +++ b/lib/ContactsMenu/Providers/CallProvider.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace OCA\Talk\ContactsMenu\Providers; +use OCA\Talk\Config; use OCP\Contacts\ContactsMenu\IActionFactory; use OCP\Contacts\ContactsMenu\IEntry; use OCP\Contacts\ContactsMenu\IProvider; @@ -36,24 +37,25 @@ class CallProvider implements IProvider { /** @var IActionFactory */ private $actionFactory; - /** @var IURLGenerator */ private $urlGenerator; - /** @var IUserManager */ private $userManager; - /** @var IL10N */ private $l10n; + /** @var Config */ + private $config; public function __construct(IActionFactory $actionFactory, IURLGenerator $urlGenerator, IL10N $l10n, - IUserManager $userManager) { + IUserManager $userManager, + Config $config) { $this->actionFactory = $actionFactory; $this->urlGenerator = $urlGenerator; $this->userManager = $userManager; $this->l10n = $l10n; + $this->config = $config; } public function process(IEntry $entry): void { @@ -75,6 +77,11 @@ class CallProvider implements IProvider { return; } + if ($this->config->isDisabledForUser($user)) { + // User can not use Talk + return; + } + $talkAction = $this->l10n->t('Talk to %s', [$user->getDisplayName()]); $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('spreed', 'app-dark.svg')); $callUrl = $this->urlGenerator->linkToRouteAbsolute('spreed.Page.index') . '?callUser=' . $user->getUID(); |