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

Use more CalendarDateTime and fewer epoch timestamps in Calendar

Summary: Ref T10747. Moves away from getDateFrom() / getDateTo() and makes a few more date/time methods more consistent.

Test Plan: Created, edited, viewed events.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10747

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

+25 -19
+1 -8
src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
··· 155 155 } 156 156 157 157 if ($this->getIsCreate() || $object->getIsRecurring()) { 158 - $until_datetime = $object->newUntilDateTime(); 159 - if ($until_datetime) { 160 - $until_epoch = $until_datetime->getEpoch(); 161 - } else { 162 - $until_epoch = null; 163 - } 164 - 165 158 $fields[] = id(new PhabricatorEpochEditField()) 166 159 ->setAllowNull(true) 167 160 ->setKey('until') ··· 171 164 ->setDescription(pht('Last instance of the event.')) 172 165 ->setConduitDescription(pht('Change when the event repeats until.')) 173 166 ->setConduitTypeDescription(pht('New final event time.')) 174 - ->setValue($until_epoch); 167 + ->setValue($object->getUntilDateTimeEpoch()); 175 168 } 176 169 177 170 $fields[] = id(new PhabricatorBoolEditField())
+4 -4
src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
··· 139 139 WHERE phid IN (%Ls) AND availabilityCacheTTL >= %d', 140 140 $user->getTableName(), 141 141 $phids, 142 - $object->getDateFromForCache()); 142 + $object->getStartDateTimeEpochForCache()); 143 143 } 144 144 145 145 return $xactions; ··· 159 159 $recurrence_end_xaction = 160 160 PhabricatorCalendarEventUntilDateTransaction::TRANSACTIONTYPE; 161 161 162 - $start_date = $object->getDateFrom(); 163 - $end_date = $object->getDateTo(); 164 - $recurrence_end = $object->getRecurrenceEndDate(); 162 + $start_date = $object->getStartDateTimeEpoch(); 163 + $end_date = $object->getEndDateTimeEpoch(); 164 + $recurrence_end = $object->getUntilDateTimeEpoch(); 165 165 $is_recurring = $object->getIsRecurring(); 166 166 167 167 $errors = array();
+13 -3
src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 184 184 ->setDescription($parent->getDescription()); 185 185 186 186 $sequence = $this->getSequenceIndex(); 187 - $duration = $this->getDuration(); 187 + $duration = $parent->getDuration(); 188 188 $epochs = $parent->getSequenceIndexEpochs($actor, $sequence, $duration); 189 189 190 190 $this ··· 277 277 } 278 278 279 279 public function getDuration() { 280 - return $this->getDateTo() - $this->getDateFrom(); 280 + return ($this->getEndDateTimeEpoch() - $this->getStartDateTimeEpoch()); 281 281 } 282 282 283 283 public function getDateEpochForTimezone( ··· 366 366 * 367 367 * @return int Event start date for availability caches. 368 368 */ 369 - public function getDateFromForCache() { 369 + public function getStartDateTimeEpochForCache() { 370 370 $epoch = $this->getStartDateTimeEpoch(); 371 371 $window = phutil_units('15 minutes in seconds'); 372 372 return ($epoch - $window); ··· 792 792 return null; 793 793 } 794 794 return $this->newDateTimeFromEpoch($epoch); 795 + } 796 + 797 + public function getUntilDateTimeEpoch() { 798 + $datetime = $this->newUntilDateTime(); 799 + 800 + if (!$datetime) { 801 + return null; 802 + } 803 + 804 + return $datetime->getEpoch(); 795 805 } 796 806 797 807 public function newDuration() {
+2 -1
src/applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php
··· 6 6 const TRANSACTIONTYPE = 'calendar.enddate'; 7 7 8 8 public function generateOldValue($object) { 9 - return $object->getDateTo(); 9 + // TODO: Upgrade this. 10 + return $object->getEndDateTimeEpoch(); 10 11 } 11 12 12 13 public function applyInternalEffects($object, $value) {
+2 -1
src/applications/calendar/xaction/PhabricatorCalendarEventStartDateTransaction.php
··· 6 6 const TRANSACTIONTYPE = 'calendar.startdate'; 7 7 8 8 public function generateOldValue($object) { 9 - return $object->getDateFrom(); 9 + // TODO: Upgrade this. 10 + return $object->getStartDateTimeEpoch(); 10 11 } 11 12 12 13 public function applyInternalEffects($object, $value) {
+2 -1
src/applications/calendar/xaction/PhabricatorCalendarEventUntilDateTransaction.php
··· 6 6 const TRANSACTIONTYPE = 'calendar.recurrenceenddate'; 7 7 8 8 public function generateOldValue($object) { 9 - return $object->getRecurrenceEndDate(); 9 + // TODO: Upgrade this. 10 + return $object->getUntilDateTimeEpoch(); 10 11 } 11 12 12 13 public function applyInternalEffects($object, $value) {
+1 -1
src/applications/people/query/PhabricatorPeopleQuery.php
··· 431 431 // because of an event, we check again for events after that one ends. 432 432 while (true) { 433 433 foreach ($events as $event) { 434 - $from = $event->getDateFromForCache(); 434 + $from = $event->getStartDateTimeEpochForCache(); 435 435 $to = $event->getEndDateTimeEpoch(); 436 436 if (($from <= $cursor) && ($to > $cursor)) { 437 437 $cursor = $to;