diff options
author | Cyrille Bollu <cyrpub@bollu.be> | 2020-09-07 17:21:58 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-11-02 14:13:37 +0300 |
commit | 74d443a7b0cd285ed1fb1f10276c1e0c872e28d8 (patch) | |
tree | bf73b22625ba5a31e510f0d84640540ad2439a36 /lib/Search | |
parent | ea36de1a8c560d0c6460c7c79c883d8cc8dbd219 (diff) |
Show avatars in search results
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
Diffstat (limited to 'lib/Search')
-rw-r--r-- | lib/Search/Provider.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Search/Provider.php b/lib/Search/Provider.php index 45fdc0b38..3ce7c3932 100644 --- a/lib/Search/Provider.php +++ b/lib/Search/Provider.php @@ -96,21 +96,31 @@ class Provider implements IProvider { array_map(function (Message $message) { $formattedDate = $this->dateTimeFormatter->formatDateTimeRelativeDay($message->getSentAt(), 'short'); $sender = $message->getFrom()->first(); + if ($sender !== null && $sender->getLabel() !== null) { $subline = $sender->getLabel() . ' – ' . $formattedDate; } else { $subline = $formattedDate; } + if ($sender !== null && $sender->getEmail() !== null) { + $from = $sender->getEmail(); + } else { + $from = null; + } + return new SearchResultEntry( - '', + is_null($from) ? '' : $this->urlGenerator->linkToRoute('mail.avatars.image', [ + 'email' => $from, + ]), $message->getSubject(), $subline, $this->urlGenerator->linkToRouteAbsolute('mail.page.thread', [ 'mailboxId' => $message->getMailboxId(), 'id' => $message->getId(), ]), // TODO: deep URL - 'icon-mail' + 'icon-mail', + !is_null($from) ); }, $messages), $last->getSentAt() |