Page MenuHomePhabricator

D19851.diff
No OneTemporary

D19851.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
@@ -3761,6 +3761,7 @@
'PhabricatorPeopleAnyOwnerDatasource' => 'applications/people/typeahead/PhabricatorPeopleAnyOwnerDatasource.php',
'PhabricatorPeopleApplication' => 'applications/people/application/PhabricatorPeopleApplication.php',
'PhabricatorPeopleApproveController' => 'applications/people/controller/PhabricatorPeopleApproveController.php',
+ 'PhabricatorPeopleAvailabilitySearchEngineAttachment' => 'applications/people/engineextension/PhabricatorPeopleAvailabilitySearchEngineAttachment.php',
'PhabricatorPeopleBadgesProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php',
'PhabricatorPeopleCommitsProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php',
'PhabricatorPeopleController' => 'applications/people/controller/PhabricatorPeopleController.php',
@@ -9640,6 +9641,7 @@
'PhabricatorPeopleAnyOwnerDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorPeopleApplication' => 'PhabricatorApplication',
'PhabricatorPeopleApproveController' => 'PhabricatorPeopleController',
+ 'PhabricatorPeopleAvailabilitySearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
'PhabricatorPeopleBadgesProfileMenuItem' => 'PhabricatorProfileMenuItem',
'PhabricatorPeopleCommitsProfileMenuItem' => 'PhabricatorProfileMenuItem',
'PhabricatorPeopleController' => 'PhabricatorController',
diff --git a/src/applications/people/engineextension/PhabricatorPeopleAvailabilitySearchEngineAttachment.php b/src/applications/people/engineextension/PhabricatorPeopleAvailabilitySearchEngineAttachment.php
new file mode 100644
--- /dev/null
+++ b/src/applications/people/engineextension/PhabricatorPeopleAvailabilitySearchEngineAttachment.php
@@ -0,0 +1,46 @@
+<?php
+
+final class PhabricatorPeopleAvailabilitySearchEngineAttachment
+ extends PhabricatorSearchEngineAttachment {
+
+ public function getAttachmentName() {
+ return pht('User Availability');
+ }
+
+ public function getAttachmentDescription() {
+ return pht('Get availability information for users.');
+ }
+
+ public function willLoadAttachmentData($query, $spec) {
+ $query->needAvailability(true);
+ }
+
+ public function getAttachmentForObject($object, $data, $spec) {
+
+ $until = $object->getAwayUntil();
+ if ($until) {
+ $until = (int)$until;
+ } else {
+ $until = null;
+ }
+
+ $value = $object->getDisplayAvailability();
+ if ($value === null) {
+ $value = PhabricatorCalendarEventInvitee::AVAILABILITY_AVAILABLE;
+ }
+
+ $name = PhabricatorCalendarEventInvitee::getAvailabilityName($value);
+ $color = PhabricatorCalendarEventInvitee::getAvailabilityColor($value);
+
+ $event_phid = $object->getAvailabilityEventPHID();
+
+ return array(
+ 'value' => $value,
+ 'until' => $until,
+ 'name' => $name,
+ 'color' => $color,
+ 'eventPHID' => $event_phid,
+ );
+ }
+
+}
diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php
--- a/src/applications/people/storage/PhabricatorUser.php
+++ b/src/applications/people/storage/PhabricatorUser.php
@@ -1466,7 +1466,10 @@
}
public function getConduitSearchAttachments() {
- return array();
+ return array(
+ id(new PhabricatorPeopleAvailabilitySearchEngineAttachment())
+ ->setAttachmentKey('availability'),
+ );
}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 8:01 PM (16 h, 59 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6775812
Default Alt Text
D19851.diff (3 KB)

Event Timeline