Page MenuHomePhabricator

D12636.id30336.diff
No OneTemporary

D12636.id30336.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1493,6 +1493,7 @@
'PhabricatorCalendarEventPHIDType' => 'applications/calendar/phid/PhabricatorCalendarEventPHIDType.php',
'PhabricatorCalendarEventQuery' => 'applications/calendar/query/PhabricatorCalendarEventQuery.php',
'PhabricatorCalendarEventSearchEngine' => 'applications/calendar/query/PhabricatorCalendarEventSearchEngine.php',
+ 'PhabricatorCalendarEventSearchIndexer' => 'applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php',
'PhabricatorCalendarEventTransaction' => 'applications/calendar/storage/PhabricatorCalendarEventTransaction.php',
'PhabricatorCalendarEventTransactionComment' => 'applications/calendar/storage/PhabricatorCalendarEventTransactionComment.php',
'PhabricatorCalendarEventTransactionQuery' => 'applications/calendar/query/PhabricatorCalendarEventTransactionQuery.php',
@@ -4830,6 +4831,7 @@
'PhabricatorCalendarEventPHIDType' => 'PhabricatorPHIDType',
'PhabricatorCalendarEventQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorCalendarEventSearchEngine' => 'PhabricatorApplicationSearchEngine',
+ 'PhabricatorCalendarEventSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PhabricatorCalendarEventTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorCalendarEventTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PhabricatorCalendarEventTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
@@ -215,4 +215,8 @@
array $xactions) {
return true;
}
+
+ protected function supportsSearch() {
+ return true;
+ }
}
diff --git a/src/applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php b/src/applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php
new file mode 100644
--- /dev/null
+++ b/src/applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php
@@ -0,0 +1,52 @@
+<?php
+
+final class PhabricatorCalendarEventSearchIndexer
+ extends PhabricatorSearchDocumentIndexer {
+
+ public function getIndexableObject() {
+ return new PhabricatorCalendarEvent();
+ }
+
+ protected function buildAbstractDocumentByPHID($phid) {
+ $event = $this->loadDocumentByPHID($phid);
+
+ $doc = new PhabricatorSearchAbstractDocument();
+ $doc->setPHID($event->getPHID());
+ $doc->setDocumentType(PhabricatorCalendarEventPHIDType::TYPECONST);
+ $doc->setDocumentTitle($event->getName());
+ $doc->setDocumentCreated($event->getDateCreated());
+ $doc->setDocumentModified($event->getDateModified());
+
+ $doc->addField(
+ PhabricatorSearchField::FIELD_BODY,
+ $event->getDescription());
+
+ $doc->addRelationship(
+ PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
+ $event->getUserPHID(),
+ PhabricatorPeopleUserPHIDType::TYPECONST,
+ $event->getDateCreated());
+
+ $doc->addRelationship(
+ PhabricatorSearchRelationship::RELATIONSHIP_OWNER,
+ $event->getUserPHID(),
+ PhabricatorPeopleUserPHIDType::TYPECONST,
+ $event->getDateCreated());
+
+ $doc->addRelationship(
+ $event->getIsCancelled()
+ ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED
+ : PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
+ $event->getPHID(),
+ PhabricatorCalendarEventPHIDType::TYPECONST,
+ time());
+
+ $this->indexTransactions(
+ $doc,
+ new PhabricatorCalendarEventTransactionQuery(),
+ array($phid));
+
+ return $doc;
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
May 21 2024, 12:07 PM (6 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6289557
Default Alt Text
D12636.id30336.diff (3 KB)

Event Timeline