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

Smooth over a few more transaction compatibility/structure issues with Calendar events

Summary: Ref T9275. This gets things roughly into shape for a cutover to EditEngine, mostly by fixing some problems with "recurrence end date" not being nullable while editing events.

Test Plan: Edited events with EditPro controller, nothing was obviously broken.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9275

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

+49 -18
+1 -1
src/__phutil_library_map__.php
··· 6633 6633 'PhabricatorCalendarEventCancelController' => 'PhabricatorCalendarController', 6634 6634 'PhabricatorCalendarEventDragController' => 'PhabricatorCalendarController', 6635 6635 'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController', 6636 - 'PhabricatorCalendarEventEditProController' => 'ManiphestController', 6636 + 'PhabricatorCalendarEventEditProController' => 'PhabricatorCalendarController', 6637 6637 'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor', 6638 6638 'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand', 6639 6639 'PhabricatorCalendarEventFulltextEngine' => 'PhabricatorFulltextEngine',
+18 -1
src/aphront/httpparametertype/AphrontEpochHTTPParameterType.php
··· 3 3 final class AphrontEpochHTTPParameterType 4 4 extends AphrontHTTPParameterType { 5 5 6 + private $allowNull; 7 + 8 + public function setAllowNull($allow_null) { 9 + $this->allowNull = $allow_null; 10 + return $this; 11 + } 12 + 13 + public function getAllowNull() { 14 + return $this->allowNull; 15 + } 16 + 6 17 protected function getParameterExists(AphrontRequest $request, $key) { 7 18 return $request->getExists($key) || 8 19 $request->getExists($key.'_d'); 9 20 } 10 21 11 22 protected function getParameterValue(AphrontRequest $request, $key) { 12 - return AphrontFormDateControlValue::newFromRequest($request, $key); 23 + $value = AphrontFormDateControlValue::newFromRequest($request, $key); 24 + 25 + if ($this->getAllowNull()) { 26 + $value->setOptional(true); 27 + } 28 + 29 + return $value; 13 30 } 14 31 15 32 protected function getParameterTypeName() {
+3 -3
src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
··· 185 185 $xactions[] = id(new PhabricatorCalendarEventTransaction()) 186 186 ->setTransactionType( 187 187 PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE) 188 - ->setNewValue($recurrence_end_date_value->getEpoch()); 188 + ->setNewValue($recurrence_end_date_value); 189 189 } 190 190 } 191 191 ··· 203 203 $xactions[] = id(new PhabricatorCalendarEventTransaction()) 204 204 ->setTransactionType( 205 205 PhabricatorCalendarEventTransaction::TYPE_START_DATE) 206 - ->setNewValue($start_value->getEpoch()); 206 + ->setNewValue($start_value); 207 207 208 208 $xactions[] = id(new PhabricatorCalendarEventTransaction()) 209 209 ->setTransactionType( 210 210 PhabricatorCalendarEventTransaction::TYPE_END_DATE) 211 - ->setNewValue($end_value->getEpoch()); 211 + ->setNewValue($end_value); 212 212 } 213 213 214 214
+1 -1
src/applications/calendar/controller/PhabricatorCalendarEventEditProController.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorCalendarEventEditProController 4 - extends ManiphestController { 4 + extends PhabricatorCalendarController { 5 5 6 6 public function handleRequest(AphrontRequest $request) { 7 7 return id(new PhabricatorCalendarEditEngine())
+12 -9
src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
··· 85 85 PhabricatorApplicationTransaction $xaction) { 86 86 switch ($xaction->getTransactionType()) { 87 87 case PhabricatorCalendarEventTransaction::TYPE_RECURRING: 88 - return $object->getIsRecurring(); 88 + return (int)$object->getIsRecurring(); 89 89 case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY: 90 - return $object->getRecurrenceFrequency(); 90 + return $object->getFrequencyUnit(); 91 91 case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE: 92 92 return $object->getRecurrenceEndDate(); 93 93 case PhabricatorCalendarEventTransaction::TYPE_NAME: ··· 120 120 PhabricatorLiskDAO $object, 121 121 PhabricatorApplicationTransaction $xaction) { 122 122 switch ($xaction->getTransactionType()) { 123 - case PhabricatorCalendarEventTransaction::TYPE_RECURRING: 124 123 case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY: 125 124 case PhabricatorCalendarEventTransaction::TYPE_NAME: 126 125 case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION: ··· 132 131 case PhabricatorCalendarEventTransaction::TYPE_DECLINE: 133 132 return PhabricatorCalendarEventInvitee::STATUS_DECLINED; 134 133 case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: 134 + case PhabricatorCalendarEventTransaction::TYPE_RECURRING: 135 135 return (int)$xaction->getNewValue(); 136 136 case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE: 137 137 case PhabricatorCalendarEventTransaction::TYPE_START_DATE: 138 138 case PhabricatorCalendarEventTransaction::TYPE_END_DATE: 139 - return $xaction->getNewValue(); 139 + return $xaction->getNewValue()->getEpoch(); 140 140 case PhabricatorCalendarEventTransaction::TYPE_INVITE: 141 141 $status_invited = PhabricatorCalendarEventInvitee::STATUS_INVITED; 142 142 $status_uninvited = PhabricatorCalendarEventInvitee::STATUS_UNINVITED; ··· 187 187 188 188 switch ($xaction->getTransactionType()) { 189 189 case PhabricatorCalendarEventTransaction::TYPE_RECURRING: 190 - return $object->setIsRecurring($xaction->getNewValue()); 190 + return $object->setIsRecurring((int)$xaction->getNewValue()); 191 191 case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY: 192 - return $object->setRecurrenceFrequency($xaction->getNewValue()); 192 + return $object->setRecurrenceFrequency( 193 + array( 194 + 'rule' => $xaction->getNewValue(), 195 + )); 193 196 case PhabricatorCalendarEventTransaction::TYPE_NAME: 194 197 $object->setName($xaction->getNewValue()); 195 198 return; ··· 370 373 371 374 foreach ($xactions as $xaction) { 372 375 if ($xaction->getTransactionType() == $start_date_xaction) { 373 - $start_date = $xaction->getNewValue(); 376 + $start_date = $xaction->getNewValue()->getEpoch(); 374 377 } else if ($xaction->getTransactionType() == $end_date_xaction) { 375 - $end_date = $xaction->getNewValue(); 378 + $end_date = $xaction->getNewValue()->getEpoch(); 376 379 } else if ($xaction->getTransactionType() == $recurrence_end_xaction) { 377 - $recurrence_end = $xaction->getNewValue(); 380 + $recurrence_end = $xaction->getNewValue()->getEpoch(); 378 381 } else if ($xaction->getTransactionType() == $is_recurrence_xaction) { 379 382 $is_recurring = $xaction->getNewValue(); 380 383 }
+12 -2
src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
··· 265 265 $this->renderHandleLink($author_phid)); 266 266 return $text; 267 267 case self::TYPE_FREQUENCY: 268 + $rule = $new; 269 + if (is_array($rule)) { 270 + $rule = idx($rule, 'rule'); 271 + } 272 + 268 273 $text = ''; 269 - switch ($new['rule']) { 274 + switch ($rule) { 270 275 case PhabricatorCalendarEvent::FREQUENCY_DAILY: 271 276 $text = pht('%s set this event to repeat daily.', 272 277 $this->renderHandleLink($author_phid)); ··· 487 492 $this->renderHandleLink($object_phid)); 488 493 return $text; 489 494 case self::TYPE_FREQUENCY: 495 + $rule = $new; 496 + if (is_array($rule)) { 497 + $rule = idx($rule, 'rule'); 498 + } 499 + 490 500 $text = ''; 491 - switch ($new['rule']) { 501 + switch ($rule) { 492 502 case PhabricatorCalendarEvent::FREQUENCY_DAILY: 493 503 $text = pht('%s set %s to repeat daily.', 494 504 $this->renderHandleLink($author_phid),
+2 -1
src/applications/transactions/editfield/PhabricatorEpochEditField.php
··· 21 21 } 22 22 23 23 protected function newHTTPParameterType() { 24 - return new AphrontEpochHTTPParameterType(); 24 + return id(new AphrontEpochHTTPParameterType()) 25 + ->setAllowNull($this->getAllowNull()); 25 26 } 26 27 27 28 protected function newConduitParameterType() {