Skip to content

Commit

Permalink
Merge pull request #6745 from nextcloud/backport/6743/stable23
Browse files Browse the repository at this point in the history
[stable23] Add attributes in search results
  • Loading branch information
nickvergessen authored Jan 5, 2022
2 parents 6717d91 + 417cc74 commit f876a74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/Search/ConversationSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,18 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
$iconClass = 'conversation-icon icon-contacts';
}

$result[] = new SearchResultEntry(
$entry = new SearchResultEntry(
$icon,
$room->getDisplayName($user->getUID()),
'',
$this->url->linkToRouteAbsolute('spreed.Page.showCall', ['token' => $room->getToken()]),
$iconClass,
true
);

$entry->addAttribute('conversation', $room->getToken());

$result[] = $entry;
}

return SearchResult::complete(
Expand Down
7 changes: 6 additions & 1 deletion lib/Search/MessageSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ protected function commentToSearchResultEntry(Room $room, IUser $user, IComment
$subline = '{user}';
}

return new SearchResultEntry(
$entry = new SearchResultEntry(
$iconUrl,
str_replace(
['{user}', '{conversation}'],
Expand All @@ -218,5 +218,10 @@ protected function commentToSearchResultEntry(Room $room, IUser $user, IComment
'icon-talk', // $iconClass,
true
);

$entry->addAttribute('conversation', $room->getToken());
$entry->addAttribute('messageId', $comment->getId());

return $entry;
}
}

0 comments on commit f876a74

Please sign in to comment.