From ae67eba84bb796ad7f3a074ec3d98126d0e5784f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 19 Aug 2022 00:09:46 +0200 Subject: Use user displayname cache for comment mentions Signed-off-by: Joas Schilling --- apps/comments/lib/Notification/Notifier.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'apps/comments/lib') diff --git a/apps/comments/lib/Notification/Notifier.php b/apps/comments/lib/Notification/Notifier.php index 7c6a40133ee..4ddb7295bfe 100644 --- a/apps/comments/lib/Notification/Notifier.php +++ b/apps/comments/lib/Notification/Notifier.php @@ -100,9 +100,9 @@ class Notifier implements INotifier { $displayName = $comment->getActorId(); $isDeletedActor = $comment->getActorType() === ICommentsManager::DELETED_USER; if ($comment->getActorType() === 'users') { - $commenter = $this->userManager->get($comment->getActorId()); - if ($commenter instanceof IUser) { - $displayName = $commenter->getDisplayName(); + $commenter = $this->userManager->getDisplayName($comment->getActorId()); + if ($commenter !== null) { + $displayName = $commenter; } } @@ -171,8 +171,8 @@ class Notifier implements INotifier { $mentions = $comment->getMentions(); foreach ($mentions as $mention) { if ($mention['type'] === 'user') { - $user = $this->userManager->get($mention['id']); - if (!$user instanceof IUser) { + $userDisplayName = $this->userManager->getDisplayName($mention['id']); + if ($userDisplayName === null) { continue; } } -- cgit v1.2.3