@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.

Add an "availaiblity" attachment for user.search

Summary: Ref T13222. See PHI990. The older `user.query` supports availability information, but it isn't currently available in a modern way. Make it available.

Test Plan: {F6048126}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13222

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

+52 -1
+2
src/__phutil_library_map__.php
··· 3761 3761 'PhabricatorPeopleAnyOwnerDatasource' => 'applications/people/typeahead/PhabricatorPeopleAnyOwnerDatasource.php', 3762 3762 'PhabricatorPeopleApplication' => 'applications/people/application/PhabricatorPeopleApplication.php', 3763 3763 'PhabricatorPeopleApproveController' => 'applications/people/controller/PhabricatorPeopleApproveController.php', 3764 + 'PhabricatorPeopleAvailabilitySearchEngineAttachment' => 'applications/people/engineextension/PhabricatorPeopleAvailabilitySearchEngineAttachment.php', 3764 3765 'PhabricatorPeopleBadgesProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php', 3765 3766 'PhabricatorPeopleCommitsProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php', 3766 3767 'PhabricatorPeopleController' => 'applications/people/controller/PhabricatorPeopleController.php', ··· 9640 9641 'PhabricatorPeopleAnyOwnerDatasource' => 'PhabricatorTypeaheadDatasource', 9641 9642 'PhabricatorPeopleApplication' => 'PhabricatorApplication', 9642 9643 'PhabricatorPeopleApproveController' => 'PhabricatorPeopleController', 9644 + 'PhabricatorPeopleAvailabilitySearchEngineAttachment' => 'PhabricatorSearchEngineAttachment', 9643 9645 'PhabricatorPeopleBadgesProfileMenuItem' => 'PhabricatorProfileMenuItem', 9644 9646 'PhabricatorPeopleCommitsProfileMenuItem' => 'PhabricatorProfileMenuItem', 9645 9647 'PhabricatorPeopleController' => 'PhabricatorController',
+46
src/applications/people/engineextension/PhabricatorPeopleAvailabilitySearchEngineAttachment.php
··· 1 + <?php 2 + 3 + final class PhabricatorPeopleAvailabilitySearchEngineAttachment 4 + extends PhabricatorSearchEngineAttachment { 5 + 6 + public function getAttachmentName() { 7 + return pht('User Availability'); 8 + } 9 + 10 + public function getAttachmentDescription() { 11 + return pht('Get availability information for users.'); 12 + } 13 + 14 + public function willLoadAttachmentData($query, $spec) { 15 + $query->needAvailability(true); 16 + } 17 + 18 + public function getAttachmentForObject($object, $data, $spec) { 19 + 20 + $until = $object->getAwayUntil(); 21 + if ($until) { 22 + $until = (int)$until; 23 + } else { 24 + $until = null; 25 + } 26 + 27 + $value = $object->getDisplayAvailability(); 28 + if ($value === null) { 29 + $value = PhabricatorCalendarEventInvitee::AVAILABILITY_AVAILABLE; 30 + } 31 + 32 + $name = PhabricatorCalendarEventInvitee::getAvailabilityName($value); 33 + $color = PhabricatorCalendarEventInvitee::getAvailabilityColor($value); 34 + 35 + $event_phid = $object->getAvailabilityEventPHID(); 36 + 37 + return array( 38 + 'value' => $value, 39 + 'until' => $until, 40 + 'name' => $name, 41 + 'color' => $color, 42 + 'eventPHID' => $event_phid, 43 + ); 44 + } 45 + 46 + }
+4 -1
src/applications/people/storage/PhabricatorUser.php
··· 1466 1466 } 1467 1467 1468 1468 public function getConduitSearchAttachments() { 1469 - return array(); 1469 + return array( 1470 + id(new PhabricatorPeopleAvailabilitySearchEngineAttachment()) 1471 + ->setAttachmentKey('availability'), 1472 + ); 1470 1473 } 1471 1474 1472 1475