Page MenuHomePhabricator

D16780.diff
No OneTemporary

D16780.diff

diff --git a/resources/sql/autopatches/20161031.calendar.01.seriesparent.sql b/resources/sql/autopatches/20161031.calendar.01.seriesparent.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20161031.calendar.01.seriesparent.sql
@@ -0,0 +1,5 @@
+ALTER TABLE {$NAMESPACE}_calendar.calendar_event
+ ADD seriesParentPHID VARBINARY(64);
+
+UPDATE {$NAMESPACE}_calendar.calendar_event
+ SET seriesParentPHID = instanceOfEventPHID;
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventCancelController.php b/src/applications/calendar/controller/PhabricatorCalendarEventCancelController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventCancelController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventCancelController.php
@@ -84,6 +84,13 @@
// 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()))
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
@@ -27,6 +27,7 @@
protected $isRecurring = 0;
+ protected $seriesParentPHID;
protected $instanceOfEventPHID;
protected $sequenceIndex;
@@ -140,10 +141,16 @@
'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 @@
'icon' => 'text32',
'mailKey' => 'bytes20',
'isRecurring' => 'bool',
+ 'seriesParentPHID' => 'phid?',
'instanceOfEventPHID' => 'phid?',
'sequenceIndex' => 'uint32?',
'isStub' => 'bool',
@@ -435,6 +443,9 @@
'columns' => array('instanceOfEventPHID', 'utcInstanceEpoch'),
'unique' => true,
),
+ 'key_series' => array(
+ 'columns' => array('seriesParentPHID', 'utcInitialEpoch'),
+ ),
),
self::CONFIG_SERIALIZATION => array(
'recurrenceFrequency' => self::SERIALIZATION_JSON,

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 11:01 PM (21 h, 31 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6724727
Default Alt Text
D16780.diff (2 KB)

Event Timeline