Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15410596
D16781.id40419.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D16781.id40419.diff
View Options
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
@@ -39,7 +39,7 @@
$validation_exception = null;
if ($request->isFormPost()) {
- $targets = array();
+ $targets = array($event);
if ($is_recurring) {
$mode = $request->getStr('mode');
$is_future = ($mode == 'future');
@@ -51,6 +51,38 @@
if ($must_fork) {
if ($is_child) {
+ $fork_target = $event;
+ } else {
+ if ($event->isValidSequenceIndex($viewer, 1)) {
+ $next_event = id(new PhabricatorCalendarEventQuery())
+ ->setViewer($viewer)
+ ->withInstanceSequencePairs(
+ array(
+ array($event->getPHID(), 1),
+ ))
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->executeOne();
+
+ if (!$next_event) {
+ $next_event = $event->newStub($viewer, 1);
+ }
+
+ $fork_target = $next_event;
+ } else {
+ // This appears to be a "recurring" event with no valid
+ // instances: for example, its "until" date is before the second
+ // instance would occur. This can happen if we already forked the
+ // event or if users entered silly stuff. Just edit the event
+ // directly without forking anything.
+ $fork_target = null;
+ }
+ }
+
+ if ($fork_target) {
$xactions = array();
$xaction = id(new PhabricatorCalendarEventTransaction())
@@ -64,20 +96,8 @@
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true);
- $editor->applyTransactions($event, array($xaction));
-
- $targets[] = $event;
- } else {
- // TODO: This is a huge mess; we need to load or generate the
- // first child, then fork that, then apply the event to the
- // parent. Just bail for now.
- throw new Exception(
- pht(
- 'Individual edits to parent events are not yet supported '.
- 'because they are real tricky to implement.'));
+ $editor->applyTransactions($fork_target, array($xaction));
}
- } else {
- $targets[] = $event;
}
if ($is_future) {
@@ -105,8 +125,6 @@
$targets[] = $future_event;
}
}
- } else {
- $targets = array($event);
}
foreach ($targets as $target) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 7:40 AM (7 h, 15 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704755
Default Alt Text
D16781.id40419.diff (2 KB)
Attached To
Mode
D16781: Support "Edit just this event" on the parent event in a series
Attached
Detach File
Event Timeline
Log In to Comment