diff options
author | Joas Schilling <coding@schilljs.com> | 2022-08-18 09:57:34 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-08-19 12:06:20 +0200 |
commit | 659c2ba7ff5bad286f9ed3f456b5759b0906c8c6 (patch) | |
tree | 77bc132123e5f5e7fde0a7c4430efadf97495dc7 /lib | |
parent | 62c85c3c7ef888c43f34f568ac139a0885a0aa9f (diff) |
Use user displayname cache in activities
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Activity/Provider/Base.php | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/lib/Activity/Provider/Base.php b/lib/Activity/Provider/Base.php index f1cc6c499..0bb75b57c 100644 --- a/lib/Activity/Provider/Base.php +++ b/lib/Activity/Provider/Base.php @@ -43,9 +43,6 @@ abstract class Base implements IProvider { protected IUserManager $userManager; protected Manager $manager; - /** @var string[] */ - protected array $displayNames = []; - public function __construct(IFactory $languageFactory, IURLGenerator $url, Config $config, @@ -134,22 +131,10 @@ abstract class Base implements IProvider { } protected function getUser(string $uid): array { - if (!isset($this->displayNames[$uid])) { - $this->displayNames[$uid] = $this->getDisplayName($uid); - } - return [ 'type' => 'user', 'id' => $uid, - 'name' => $this->displayNames[$uid], + 'name' => $this->userManager->getDisplayName($uid) ?? $uid, ]; } - - protected function getDisplayName(string $uid): string { - $user = $this->userManager->get($uid); - if ($user instanceof IUser) { - return $user->getDisplayName(); - } - return $uid; - } } |