]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: https://github.com/nextcloud/calendar/issues/6079 and https://github.com/nextclo... 46464/head
authortobiasKaminsky <tobias@kaminsky.me>
Fri, 12 Jul 2024 07:18:16 +0000 (09:18 +0200)
committerBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Thu, 25 Jul 2024 13:42:09 +0000 (15:42 +0200)
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
apps/dav/lib/Search/ContactsSearchProvider.php
apps/dav/lib/Search/EventsSearchProvider.php

index e2284c64e51880d4e35508cc953ac8e1dd8aa651..b0f6f1a044c80d5c882d9b15968eb7ae13afa4f9 100644 (file)
@@ -111,7 +111,12 @@ class ContactsSearchProvider implements IFilteringProvider {
                        $subline = $this->generateSubline($vCard);
                        $resourceUrl = $this->getDeepLinkToContactsApp($addressBook['uri'], (string) $vCard->UID);
 
-                       return new SearchResultEntry($thumbnailUrl, $title, $subline, $resourceUrl, 'icon-contacts-dark', true);
+                       $result = new SearchResultEntry($thumbnailUrl, $title, $subline, $resourceUrl, 'icon-contacts-dark', true);
+                       $result->addAttribute("displayName", $title);
+                       $result->addAttribute("email", $subline);
+                       $result->addAttribute("phoneNumber", (string)$vCard->TEL);
+
+                       return $result;
                }, $searchResults);
 
                return SearchResult::paginated(
index d45fd638e80b72aa6546c1644898998635e619ba..6c9fe5167c5bc0245e014a1f3b42a28a2c7880b1 100644 (file)
@@ -17,6 +17,7 @@ use OCP\Search\SearchResultEntry;
 use Sabre\VObject\Component;
 use Sabre\VObject\DateTimeParser;
 use Sabre\VObject\Property;
+use Sabre\VObject\Property\ICalendar\DateTime;
 use function array_combine;
 use function array_fill;
 use function array_key_exists;
@@ -157,8 +158,16 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering
                                $calendar = $subscriptionsById[$eventRow['calendarid']];
                        }
                        $resourceUrl = $this->getDeepLinkToCalendarApp($calendar['principaluri'], $calendar['uri'], $eventRow['uri']);
+                       $result = new SearchResultEntry('', $title, $subline, $resourceUrl, 'icon-calendar-dark', false);
 
-                       return new SearchResultEntry('', $title, $subline, $resourceUrl, 'icon-calendar-dark', false);
+                       $dtStart = $component->DTSTART;
+
+                       if ($dtStart instanceof DateTime) {
+                               $startDateTime = $dtStart->getDateTime()->format('U');
+                               $result->addAttribute("createdAt", $startDateTime);
+                       }
+
+                       return $result;
                }, $searchResults);
 
                return SearchResult::paginated(