Merge pull request #4903 from nextcloud/feat/display-name-cache
feat: Use user display name cache
This commit is contained in:
@@ -37,7 +37,7 @@ class User extends RelationalObject {
|
||||
public function getObjectSerialization() {
|
||||
return [
|
||||
'uid' => $this->getObject()->getUID(),
|
||||
'displayname' => $this->getObject()->getDisplayName(),
|
||||
'displayname' => $this->getDisplayName(),
|
||||
'type' => Acl::PERMISSION_TYPE_USER
|
||||
];
|
||||
}
|
||||
|
||||
@@ -197,8 +197,7 @@ class CommentService {
|
||||
}
|
||||
|
||||
private function formatComment(IComment $comment, $addReplyTo = false): array {
|
||||
$user = $this->userManager->get($comment->getActorId());
|
||||
$actorDisplayName = $user !== null ? $user->getDisplayName() : $comment->getActorId();
|
||||
$actorDisplayName = $this->userManager->getDisplayName($comment->getActorId()) ?? $comment->getActorId();
|
||||
|
||||
$formattedComment = [
|
||||
'id' => (int)$comment->getId(),
|
||||
|
||||
@@ -115,8 +115,7 @@ class SearchService {
|
||||
$card = Card::fromRow($cardRow);
|
||||
// TODO: Only perform one enrich call here
|
||||
$self->cardService->enrichCards([$card]);
|
||||
$user = $this->userManager->get($comment->getActorId());
|
||||
$displayName = $user ? $user->getDisplayName() : '';
|
||||
$displayName = $this->userManager->getDisplayName($comment->getActorId()) ?? '';
|
||||
return new CommentSearchResultEntry($comment->getId(), $comment->getMessage(), $displayName, $card, $this->urlGenerator, $this->l10n);
|
||||
}, $matchedComments);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user