diff options
author | Joas Schilling <coding@schilljs.com> | 2022-01-04 12:36:52 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-01-04 12:36:52 +0300 |
commit | 5ee5931861d99fdb8d5cda490a11cdd73f100c0e (patch) | |
tree | a68917c02e54412c8ad741dda32bdb7bea52cf9f /lib | |
parent | 9ee8ec1eaad0890e8169f9927b805ebb338d71d5 (diff) |
Add attributes in search results
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Search/ConversationSearch.php | 6 | ||||
-rw-r--r-- | lib/Search/MessageSearch.php | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/Search/ConversationSearch.php b/lib/Search/ConversationSearch.php index bde25c053..8638ff63e 100644 --- a/lib/Search/ConversationSearch.php +++ b/lib/Search/ConversationSearch.php @@ -141,7 +141,7 @@ class ConversationSearch implements IProvider { $iconClass = 'conversation-icon icon-contacts'; } - $result[] = new SearchResultEntry( + $entry = new SearchResultEntry( $icon, $room->getDisplayName($user->getUID()), '', @@ -149,6 +149,10 @@ class ConversationSearch implements IProvider { $iconClass, true ); + + $entry->addAttribute('conversation', $room->getToken()); + + $result[] = $entry; } return SearchResult::complete( diff --git a/lib/Search/MessageSearch.php b/lib/Search/MessageSearch.php index 04fc4b8d2..cd442e8cf 100644 --- a/lib/Search/MessageSearch.php +++ b/lib/Search/MessageSearch.php @@ -206,7 +206,7 @@ class MessageSearch implements IProvider { $subline = '{user}'; } - return new SearchResultEntry( + $entry = new SearchResultEntry( $iconUrl, str_replace( ['{user}', '{conversation}'], @@ -218,5 +218,10 @@ class MessageSearch implements IProvider { 'icon-talk', // $iconClass, true ); + + $entry->addAttribute('conversation', $room->getToken()); + $entry->addAttribute('messageId', $comment->getId()); + + return $entry; } } |