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

Support "Edit just this event" on the parent event in a series

Summary:
Ref T11804. This one is messy because we have to fork the //next// event, possibly creating it first.

Then we can edit the parent normally.

Test Plan: Cancelled the first event in a series, only that one cancelled.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11804

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

+34 -16
+34 -16
src/applications/calendar/controller/PhabricatorCalendarEventCancelController.php
··· 39 39 $validation_exception = null; 40 40 if ($request->isFormPost()) { 41 41 42 - $targets = array(); 42 + $targets = array($event); 43 43 if ($is_recurring) { 44 44 $mode = $request->getStr('mode'); 45 45 $is_future = ($mode == 'future'); ··· 51 51 52 52 if ($must_fork) { 53 53 if ($is_child) { 54 + $fork_target = $event; 55 + } else { 56 + if ($event->isValidSequenceIndex($viewer, 1)) { 57 + $next_event = id(new PhabricatorCalendarEventQuery()) 58 + ->setViewer($viewer) 59 + ->withInstanceSequencePairs( 60 + array( 61 + array($event->getPHID(), 1), 62 + )) 63 + ->requireCapabilities( 64 + array( 65 + PhabricatorPolicyCapability::CAN_VIEW, 66 + PhabricatorPolicyCapability::CAN_EDIT, 67 + )) 68 + ->executeOne(); 69 + 70 + if (!$next_event) { 71 + $next_event = $event->newStub($viewer, 1); 72 + } 73 + 74 + $fork_target = $next_event; 75 + } else { 76 + // This appears to be a "recurring" event with no valid 77 + // instances: for example, its "until" date is before the second 78 + // instance would occur. This can happen if we already forked the 79 + // event or if users entered silly stuff. Just edit the event 80 + // directly without forking anything. 81 + $fork_target = null; 82 + } 83 + } 84 + 85 + if ($fork_target) { 54 86 $xactions = array(); 55 87 56 88 $xaction = id(new PhabricatorCalendarEventTransaction()) ··· 64 96 ->setContinueOnNoEffect(true) 65 97 ->setContinueOnMissingFields(true); 66 98 67 - $editor->applyTransactions($event, array($xaction)); 68 - 69 - $targets[] = $event; 70 - } else { 71 - // TODO: This is a huge mess; we need to load or generate the 72 - // first child, then fork that, then apply the event to the 73 - // parent. Just bail for now. 74 - throw new Exception( 75 - pht( 76 - 'Individual edits to parent events are not yet supported '. 77 - 'because they are real tricky to implement.')); 99 + $editor->applyTransactions($fork_target, array($xaction)); 78 100 } 79 - } else { 80 - $targets[] = $event; 81 101 } 82 102 83 103 if ($is_future) { ··· 105 125 $targets[] = $future_event; 106 126 } 107 127 } 108 - } else { 109 - $targets = array($event); 110 128 } 111 129 112 130 foreach ($targets as $target) {