Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/query/PhabricatorPeopleQuery.php
Show First 20 Lines • Show All 419 Lines • ▼ Show 20 Lines | private function rebuildAvailabilityCache(array $rebuild) { | ||||
$invitee_map = array(); | $invitee_map = array(); | ||||
foreach ($events as $event) { | foreach ($events as $event) { | ||||
foreach ($event->getInvitees() as $invitee) { | foreach ($event->getInvitees() as $invitee) { | ||||
if (!$invitee->isAttending()) { | if (!$invitee->isAttending()) { | ||||
continue; | continue; | ||||
} | } | ||||
// If the user is set to "Available" for this event, don't consider it | // If the user is set to "Available" for this event, don't consider it | ||||
// when computin their away status. | // when computing their away status. | ||||
if (!$invitee->getDisplayAvailability($event)) { | if (!$invitee->getDisplayAvailability($event)) { | ||||
continue; | continue; | ||||
} | } | ||||
$invitee_phid = $invitee->getInviteePHID(); | $invitee_phid = $invitee->getInviteePHID(); | ||||
if (!isset($rebuild[$invitee_phid])) { | if (!isset($rebuild[$invitee_phid])) { | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | foreach ($rebuild as $phid => $user) { | ||||
'availability' => $availability_type, | 'availability' => $availability_type, | ||||
); | ); | ||||
// We only cache this availability until the end of the current event, | // We only cache this availability until the end of the current event, | ||||
// since the event PHID (and possibly the availability type) are only | // since the event PHID (and possibly the availability type) are only | ||||
// valid for that long. | // valid for that long. | ||||
// NOTE: This doesn't handle overlapping events with the greatest | // NOTE: This doesn't handle overlapping events with the greatest | ||||
// possible care. In theory, if you're attenting multiple events | // possible care. In theory, if you're attending multiple events | ||||
// simultaneously we should accommodate that. However, it's complex | // simultaneously we should accommodate that. However, it's complex | ||||
// to compute, rare, and probably not confusing most of the time. | // to compute, rare, and probably not confusing most of the time. | ||||
$availability_ttl = $next_event->getEndDateTimeEpochForCache(); | $availability_ttl = $next_event->getEndDateTimeEpochForCache(); | ||||
} else { | } else { | ||||
$availability = array( | $availability = array( | ||||
'until' => null, | 'until' => null, | ||||
'eventPHID' => null, | 'eventPHID' => null, | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |