@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Calendar events should be supported in global search

Summary: Closes T7937, Calendar events should be supported in global search.

Test Plan: Search for part of calendar event title in global search, event should be in search results.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7937

Differential Revision: https://secure.phabricator.com/D12636

+58
+2
src/__phutil_library_map__.php
··· 1493 1493 'PhabricatorCalendarEventPHIDType' => 'applications/calendar/phid/PhabricatorCalendarEventPHIDType.php', 1494 1494 'PhabricatorCalendarEventQuery' => 'applications/calendar/query/PhabricatorCalendarEventQuery.php', 1495 1495 'PhabricatorCalendarEventSearchEngine' => 'applications/calendar/query/PhabricatorCalendarEventSearchEngine.php', 1496 + 'PhabricatorCalendarEventSearchIndexer' => 'applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php', 1496 1497 'PhabricatorCalendarEventTransaction' => 'applications/calendar/storage/PhabricatorCalendarEventTransaction.php', 1497 1498 'PhabricatorCalendarEventTransactionComment' => 'applications/calendar/storage/PhabricatorCalendarEventTransactionComment.php', 1498 1499 'PhabricatorCalendarEventTransactionQuery' => 'applications/calendar/query/PhabricatorCalendarEventTransactionQuery.php', ··· 4830 4831 'PhabricatorCalendarEventPHIDType' => 'PhabricatorPHIDType', 4831 4832 'PhabricatorCalendarEventQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 4832 4833 'PhabricatorCalendarEventSearchEngine' => 'PhabricatorApplicationSearchEngine', 4834 + 'PhabricatorCalendarEventSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 4833 4835 'PhabricatorCalendarEventTransaction' => 'PhabricatorApplicationTransaction', 4834 4836 'PhabricatorCalendarEventTransactionComment' => 'PhabricatorApplicationTransactionComment', 4835 4837 'PhabricatorCalendarEventTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
+4
src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
··· 215 215 array $xactions) { 216 216 return true; 217 217 } 218 + 219 + protected function supportsSearch() { 220 + return true; 221 + } 218 222 }
+52
src/applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php
··· 1 + <?php 2 + 3 + final class PhabricatorCalendarEventSearchIndexer 4 + extends PhabricatorSearchDocumentIndexer { 5 + 6 + public function getIndexableObject() { 7 + return new PhabricatorCalendarEvent(); 8 + } 9 + 10 + protected function buildAbstractDocumentByPHID($phid) { 11 + $event = $this->loadDocumentByPHID($phid); 12 + 13 + $doc = new PhabricatorSearchAbstractDocument(); 14 + $doc->setPHID($event->getPHID()); 15 + $doc->setDocumentType(PhabricatorCalendarEventPHIDType::TYPECONST); 16 + $doc->setDocumentTitle($event->getName()); 17 + $doc->setDocumentCreated($event->getDateCreated()); 18 + $doc->setDocumentModified($event->getDateModified()); 19 + 20 + $doc->addField( 21 + PhabricatorSearchField::FIELD_BODY, 22 + $event->getDescription()); 23 + 24 + $doc->addRelationship( 25 + PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, 26 + $event->getUserPHID(), 27 + PhabricatorPeopleUserPHIDType::TYPECONST, 28 + $event->getDateCreated()); 29 + 30 + $doc->addRelationship( 31 + PhabricatorSearchRelationship::RELATIONSHIP_OWNER, 32 + $event->getUserPHID(), 33 + PhabricatorPeopleUserPHIDType::TYPECONST, 34 + $event->getDateCreated()); 35 + 36 + $doc->addRelationship( 37 + $event->getIsCancelled() 38 + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED 39 + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, 40 + $event->getPHID(), 41 + PhabricatorCalendarEventPHIDType::TYPECONST, 42 + time()); 43 + 44 + $this->indexTransactions( 45 + $doc, 46 + new PhabricatorCalendarEventTransactionQuery(), 47 + array($phid)); 48 + 49 + return $doc; 50 + } 51 + 52 + }