mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 13:22:42 +01:00
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
This commit is contained in:
parent
11e8e60245
commit
d4a4cc795d
3 changed files with 58 additions and 0 deletions
|
@ -1493,6 +1493,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorCalendarEventPHIDType' => 'applications/calendar/phid/PhabricatorCalendarEventPHIDType.php',
|
'PhabricatorCalendarEventPHIDType' => 'applications/calendar/phid/PhabricatorCalendarEventPHIDType.php',
|
||||||
'PhabricatorCalendarEventQuery' => 'applications/calendar/query/PhabricatorCalendarEventQuery.php',
|
'PhabricatorCalendarEventQuery' => 'applications/calendar/query/PhabricatorCalendarEventQuery.php',
|
||||||
'PhabricatorCalendarEventSearchEngine' => 'applications/calendar/query/PhabricatorCalendarEventSearchEngine.php',
|
'PhabricatorCalendarEventSearchEngine' => 'applications/calendar/query/PhabricatorCalendarEventSearchEngine.php',
|
||||||
|
'PhabricatorCalendarEventSearchIndexer' => 'applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php',
|
||||||
'PhabricatorCalendarEventTransaction' => 'applications/calendar/storage/PhabricatorCalendarEventTransaction.php',
|
'PhabricatorCalendarEventTransaction' => 'applications/calendar/storage/PhabricatorCalendarEventTransaction.php',
|
||||||
'PhabricatorCalendarEventTransactionComment' => 'applications/calendar/storage/PhabricatorCalendarEventTransactionComment.php',
|
'PhabricatorCalendarEventTransactionComment' => 'applications/calendar/storage/PhabricatorCalendarEventTransactionComment.php',
|
||||||
'PhabricatorCalendarEventTransactionQuery' => 'applications/calendar/query/PhabricatorCalendarEventTransactionQuery.php',
|
'PhabricatorCalendarEventTransactionQuery' => 'applications/calendar/query/PhabricatorCalendarEventTransactionQuery.php',
|
||||||
|
@ -4830,6 +4831,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorCalendarEventPHIDType' => 'PhabricatorPHIDType',
|
'PhabricatorCalendarEventPHIDType' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorCalendarEventQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorCalendarEventQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorCalendarEventSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PhabricatorCalendarEventSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
|
'PhabricatorCalendarEventSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
||||||
'PhabricatorCalendarEventTransaction' => 'PhabricatorApplicationTransaction',
|
'PhabricatorCalendarEventTransaction' => 'PhabricatorApplicationTransaction',
|
||||||
'PhabricatorCalendarEventTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
'PhabricatorCalendarEventTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
||||||
'PhabricatorCalendarEventTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
'PhabricatorCalendarEventTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||||
|
|
|
@ -215,4 +215,8 @@ final class PhabricatorCalendarEventEditor
|
||||||
array $xactions) {
|
array $xactions) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function supportsSearch() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue