Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15437538
D16663.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D16663.id.diff
View Options
diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
@@ -155,13 +155,6 @@
}
if ($this->getIsCreate() || $object->getIsRecurring()) {
- $until_datetime = $object->newUntilDateTime();
- if ($until_datetime) {
- $until_epoch = $until_datetime->getEpoch();
- } else {
- $until_epoch = null;
- }
-
$fields[] = id(new PhabricatorEpochEditField())
->setAllowNull(true)
->setKey('until')
@@ -171,7 +164,7 @@
->setDescription(pht('Last instance of the event.'))
->setConduitDescription(pht('Change when the event repeats until.'))
->setConduitTypeDescription(pht('New final event time.'))
- ->setValue($until_epoch);
+ ->setValue($object->getUntilDateTimeEpoch());
}
$fields[] = id(new PhabricatorBoolEditField())
diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
@@ -139,7 +139,7 @@
WHERE phid IN (%Ls) AND availabilityCacheTTL >= %d',
$user->getTableName(),
$phids,
- $object->getDateFromForCache());
+ $object->getStartDateTimeEpochForCache());
}
return $xactions;
@@ -159,9 +159,9 @@
$recurrence_end_xaction =
PhabricatorCalendarEventUntilDateTransaction::TRANSACTIONTYPE;
- $start_date = $object->getDateFrom();
- $end_date = $object->getDateTo();
- $recurrence_end = $object->getRecurrenceEndDate();
+ $start_date = $object->getStartDateTimeEpoch();
+ $end_date = $object->getEndDateTimeEpoch();
+ $recurrence_end = $object->getUntilDateTimeEpoch();
$is_recurring = $object->getIsRecurring();
$errors = array();
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -184,7 +184,7 @@
->setDescription($parent->getDescription());
$sequence = $this->getSequenceIndex();
- $duration = $this->getDuration();
+ $duration = $parent->getDuration();
$epochs = $parent->getSequenceIndexEpochs($actor, $sequence, $duration);
$this
@@ -277,7 +277,7 @@
}
public function getDuration() {
- return $this->getDateTo() - $this->getDateFrom();
+ return ($this->getEndDateTimeEpoch() - $this->getStartDateTimeEpoch());
}
public function getDateEpochForTimezone(
@@ -366,7 +366,7 @@
*
* @return int Event start date for availability caches.
*/
- public function getDateFromForCache() {
+ public function getStartDateTimeEpochForCache() {
$epoch = $this->getStartDateTimeEpoch();
$window = phutil_units('15 minutes in seconds');
return ($epoch - $window);
@@ -794,6 +794,16 @@
return $this->newDateTimeFromEpoch($epoch);
}
+ public function getUntilDateTimeEpoch() {
+ $datetime = $this->newUntilDateTime();
+
+ if (!$datetime) {
+ return null;
+ }
+
+ return $datetime->getEpoch();
+ }
+
public function newDuration() {
return id(new PhutilCalendarDuration())
->setSeconds($this->getDuration());
diff --git a/src/applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php b/src/applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php
--- a/src/applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php
+++ b/src/applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php
@@ -6,7 +6,8 @@
const TRANSACTIONTYPE = 'calendar.enddate';
public function generateOldValue($object) {
- return $object->getDateTo();
+ // TODO: Upgrade this.
+ return $object->getEndDateTimeEpoch();
}
public function applyInternalEffects($object, $value) {
diff --git a/src/applications/calendar/xaction/PhabricatorCalendarEventStartDateTransaction.php b/src/applications/calendar/xaction/PhabricatorCalendarEventStartDateTransaction.php
--- a/src/applications/calendar/xaction/PhabricatorCalendarEventStartDateTransaction.php
+++ b/src/applications/calendar/xaction/PhabricatorCalendarEventStartDateTransaction.php
@@ -6,7 +6,8 @@
const TRANSACTIONTYPE = 'calendar.startdate';
public function generateOldValue($object) {
- return $object->getDateFrom();
+ // TODO: Upgrade this.
+ return $object->getStartDateTimeEpoch();
}
public function applyInternalEffects($object, $value) {
diff --git a/src/applications/calendar/xaction/PhabricatorCalendarEventUntilDateTransaction.php b/src/applications/calendar/xaction/PhabricatorCalendarEventUntilDateTransaction.php
--- a/src/applications/calendar/xaction/PhabricatorCalendarEventUntilDateTransaction.php
+++ b/src/applications/calendar/xaction/PhabricatorCalendarEventUntilDateTransaction.php
@@ -6,7 +6,8 @@
const TRANSACTIONTYPE = 'calendar.recurrenceenddate';
public function generateOldValue($object) {
- return $object->getRecurrenceEndDate();
+ // TODO: Upgrade this.
+ return $object->getUntilDateTimeEpoch();
}
public function applyInternalEffects($object, $value) {
diff --git a/src/applications/people/query/PhabricatorPeopleQuery.php b/src/applications/people/query/PhabricatorPeopleQuery.php
--- a/src/applications/people/query/PhabricatorPeopleQuery.php
+++ b/src/applications/people/query/PhabricatorPeopleQuery.php
@@ -431,7 +431,7 @@
// because of an event, we check again for events after that one ends.
while (true) {
foreach ($events as $event) {
- $from = $event->getDateFromForCache();
+ $from = $event->getStartDateTimeEpochForCache();
$to = $event->getEndDateTimeEpoch();
if (($from <= $cursor) && ($to > $cursor)) {
$cursor = $to;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 26, 8:10 PM (6 d, 2 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7437714
Default Alt Text
D16663.id.diff (6 KB)
Attached To
Mode
D16663: Use more CalendarDateTime and fewer epoch timestamps in Calendar
Attached
Detach File
Event Timeline
Log In to Comment