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

Fix two issues with user Calendar event availability cache display

Summary:
Ref T11816. Two minor issues:

- We used `$event`, not `$next_event`, as the event providing the PHID for "Busy at <event name>". This rendered "Busy at <most future event>" on the profile instead of "Busy at <next upcoming event".
- The TTL computation used the event start, not the event end, so we could end up rebuilding the cache too often for users busy at an event.

Test Plan:
- Attended an event in the near future and one later on.
- Saw profile now say "busy at <near future event>" correctly.
- In DarkConsole "Services" tab, no longer saw unnecessary cache refills while attending an event.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11816

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

+8 -4
+4
src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 391 391 return ($epoch - $window); 392 392 } 393 393 394 + public function getEndDateTimeEpochForCache() { 395 + return $this->getEndDateTimeEpoch(); 396 + } 397 + 394 398 protected function getConfiguration() { 395 399 return array( 396 400 self::CONFIG_AUX_PHID => true,
+3 -3
src/applications/people/query/PhabricatorPeopleQuery.php
··· 465 465 while (true) { 466 466 foreach ($events as $event) { 467 467 $from = $event->getStartDateTimeEpochForCache(); 468 - $to = $event->getEndDateTimeEpoch(); 468 + $to = $event->getEndDateTimeEpochForCache(); 469 469 if (($from <= $cursor) && ($to > $cursor)) { 470 470 $cursor = $to; 471 471 if (!$next_event) { ··· 483 483 $availability_type = $invitee->getDisplayAvailability($next_event); 484 484 $availability = array( 485 485 'until' => $cursor, 486 - 'eventPHID' => $event->getPHID(), 486 + 'eventPHID' => $next_event->getPHID(), 487 487 'availability' => $availability_type, 488 488 ); 489 489 ··· 496 496 // simultaneously we should accommodate that. However, it's complex 497 497 // to compute, rare, and probably not confusing most of the time. 498 498 499 - $availability_ttl = $next_event->getStartDateTimeEpochForCache(); 499 + $availability_ttl = $next_event->getEndDateTimeEpochForCache(); 500 500 } else { 501 501 $availability = array( 502 502 'until' => null,
+1 -1
src/applications/people/storage/PhabricatorUser.php
··· 1082 1082 'UPDATE %T SET availabilityCache = %s, availabilityCacheTTL = %nd 1083 1083 WHERE id = %d', 1084 1084 $this->getTableName(), 1085 - json_encode($availability), 1085 + phutil_json_encode($availability), 1086 1086 $ttl, 1087 1087 $this->getID()); 1088 1088 unset($unguarded);