mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-17 20:32:41 +01:00
Record a "series parent PHID" on Calendar events that retains relationships after forks
Summary: When you edit "X and all future events", X becomes the new parent of an event series. Currently, it loses its relationship to its original parent. Instead, retain that relationship -- it's separate from the normal "parent", but we can use it to make the UI more clear or tweak behaviors later. This mostly just keeps us from losing/destroying data that we might need/want later. Test Plan: - Ran migrations. - Cancelled "X and all future events", saw sensible-appearing beahvior in the database for "seriesParentPHID". Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D16780
This commit is contained in:
parent
f44a9a4e48
commit
b084efb362
3 changed files with 23 additions and 0 deletions
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE {$NAMESPACE}_calendar.calendar_event
|
||||
ADD seriesParentPHID VARBINARY(64);
|
||||
|
||||
UPDATE {$NAMESPACE}_calendar.calendar_event
|
||||
SET seriesParentPHID = instanceOfEventPHID;
|
|
@ -84,6 +84,13 @@ final class PhabricatorCalendarEventCancelController
|
|||
// NOTE: If you can't edit some of the future events, we just
|
||||
// don't try to update them. This seems like it's probably what
|
||||
// users are likely to expect.
|
||||
|
||||
// NOTE: This only affects events that are currently in the same
|
||||
// series, not all events that were ever in the original series.
|
||||
// We could use series PHIDs instead of parent PHIDs to affect more
|
||||
// events if this turns out to be counterintuitive. Other
|
||||
// applications differ in their behavior.
|
||||
|
||||
$future = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($viewer)
|
||||
->withParentEventPHIDs(array($event->getPHID()))
|
||||
|
|
|
@ -27,6 +27,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
|
||||
protected $isRecurring = 0;
|
||||
|
||||
protected $seriesParentPHID;
|
||||
protected $instanceOfEventPHID;
|
||||
protected $sequenceIndex;
|
||||
|
||||
|
@ -140,10 +141,16 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
'a recurring parent event!'));
|
||||
}
|
||||
|
||||
$series_phid = $this->getSeriesParentPHID();
|
||||
if (!$series_phid) {
|
||||
$series_phid = $this->getPHID();
|
||||
}
|
||||
|
||||
$child = id(new self())
|
||||
->setIsCancelled(0)
|
||||
->setIsStub(0)
|
||||
->setInstanceOfEventPHID($this->getPHID())
|
||||
->setSeriesParentPHID($series_phid)
|
||||
->setSequenceIndex($sequence)
|
||||
->setIsRecurring(true)
|
||||
->attachParentEvent($this)
|
||||
|
@ -401,6 +408,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
'icon' => 'text32',
|
||||
'mailKey' => 'bytes20',
|
||||
'isRecurring' => 'bool',
|
||||
'seriesParentPHID' => 'phid?',
|
||||
'instanceOfEventPHID' => 'phid?',
|
||||
'sequenceIndex' => 'uint32?',
|
||||
'isStub' => 'bool',
|
||||
|
@ -435,6 +443,9 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
'columns' => array('instanceOfEventPHID', 'utcInstanceEpoch'),
|
||||
'unique' => true,
|
||||
),
|
||||
'key_series' => array(
|
||||
'columns' => array('seriesParentPHID', 'utcInitialEpoch'),
|
||||
),
|
||||
),
|
||||
self::CONFIG_SERIALIZATION => array(
|
||||
'recurrenceFrequency' => self::SERIALIZATION_JSON,
|
||||
|
|
Loading…
Reference in a new issue