diff options
author | Joas Schilling <coding@schilljs.com> | 2022-08-18 23:52:34 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-08-19 10:48:32 +0200 |
commit | 7e1177819023a185480b5251e3a22dc429948518 (patch) | |
tree | 66288b17692cfcdde3e3273051e00224b4167b1f /apps/comments | |
parent | cab0f1327e28104ef61e8767f963d20cf38544af (diff) | |
download | nextcloud-server-7e1177819023a185480b5251e3a22dc429948518.tar.gz nextcloud-server-7e1177819023a185480b5251e3a22dc429948518.zip |
Use user name cache in activity providers
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/comments')
-rw-r--r-- | apps/comments/lib/Activity/Provider.php | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php index 715be29e2ed..c6e55326580 100644 --- a/apps/comments/lib/Activity/Provider.php +++ b/apps/comments/lib/Activity/Provider.php @@ -43,8 +43,6 @@ class Provider implements IProvider { protected ICommentsManager $commentsManager; protected IUserManager $userManager; protected IManager $activityManager; - /** @var string[] */ - protected array $displayNames = []; public function __construct(IFactory $languageFactory, IURLGenerator $url, ICommentsManager $commentsManager, IUserManager $userManager, IManager $activityManager) { $this->languageFactory = $languageFactory; @@ -213,22 +211,10 @@ class Provider implements IProvider { } protected function generateUserParameter(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; - } } |