diff options
author | Joas Schilling <coding@schilljs.com> | 2019-02-27 10:58:03 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-03-01 10:53:23 +0300 |
commit | 5b5dfee9c7d11d9ae5527fdcfd736d0ecb86ba92 (patch) | |
tree | f86d344dc6b8870d7f2972a7e967b3365f6aa007 /lib/Activity | |
parent | 0e0a66a8230da36f49ffa533f2e09bed397bede3 (diff) |
Hide activities for users who can not Talk
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Activity')
-rw-r--r-- | lib/Activity/Provider/Base.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Activity/Provider/Base.php b/lib/Activity/Provider/Base.php index 137eb2a35..0b4da5a7b 100644 --- a/lib/Activity/Provider/Base.php +++ b/lib/Activity/Provider/Base.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace OCA\Spreed\Activity\Provider; +use OCA\Spreed\Config; use OCA\Spreed\Manager; use OCA\Spreed\Room; use OCP\Activity\IEvent; @@ -37,16 +38,14 @@ abstract class Base implements IProvider { /** @var IFactory */ protected $languageFactory; - /** @var IURLGenerator */ protected $url; - + /** @var Config */ + protected $config; /** @var IManager */ protected $activityManager; - /** @var IUserManager */ protected $userManager; - /** @var Manager */ protected $manager; @@ -55,11 +54,13 @@ abstract class Base implements IProvider { public function __construct(IFactory $languageFactory, IURLGenerator $url, + Config $config, IManager $activityManager, IUserManager $userManager, Manager $manager) { $this->languageFactory = $languageFactory; $this->url = $url; + $this->config = $config; $this->activityManager = $activityManager; $this->userManager = $userManager; $this->manager = $manager; @@ -75,6 +76,11 @@ abstract class Base implements IProvider { throw new \InvalidArgumentException('Wrong app'); } + $user = $this->userManager->get($event->getAffectedUser()); + if (!$user instanceof IUser || $this->config->isDisabledForUser($user)) { + throw new \InvalidArgumentException('User can not user Talk'); + } + if ($this->activityManager->getRequirePNG()) { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('spreed', 'app-dark.png'))); } else { |