Page MenuHomePhabricator

D16282.diff
No OneTemporary

D16282.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -6633,7 +6633,7 @@
'PhabricatorCalendarEventCancelController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventDragController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController',
- 'PhabricatorCalendarEventEditProController' => 'ManiphestController',
+ 'PhabricatorCalendarEventEditProController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand',
'PhabricatorCalendarEventFulltextEngine' => 'PhabricatorFulltextEngine',
diff --git a/src/aphront/httpparametertype/AphrontEpochHTTPParameterType.php b/src/aphront/httpparametertype/AphrontEpochHTTPParameterType.php
--- a/src/aphront/httpparametertype/AphrontEpochHTTPParameterType.php
+++ b/src/aphront/httpparametertype/AphrontEpochHTTPParameterType.php
@@ -3,13 +3,30 @@
final class AphrontEpochHTTPParameterType
extends AphrontHTTPParameterType {
+ private $allowNull;
+
+ public function setAllowNull($allow_null) {
+ $this->allowNull = $allow_null;
+ return $this;
+ }
+
+ public function getAllowNull() {
+ return $this->allowNull;
+ }
+
protected function getParameterExists(AphrontRequest $request, $key) {
return $request->getExists($key) ||
$request->getExists($key.'_d');
}
protected function getParameterValue(AphrontRequest $request, $key) {
- return AphrontFormDateControlValue::newFromRequest($request, $key);
+ $value = AphrontFormDateControlValue::newFromRequest($request, $key);
+
+ if ($this->getAllowNull()) {
+ $value->setOptional(true);
+ }
+
+ return $value;
}
protected function getParameterTypeName() {
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
@@ -185,7 +185,7 @@
$xactions[] = id(new PhabricatorCalendarEventTransaction())
->setTransactionType(
PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE)
- ->setNewValue($recurrence_end_date_value->getEpoch());
+ ->setNewValue($recurrence_end_date_value);
}
}
@@ -203,12 +203,12 @@
$xactions[] = id(new PhabricatorCalendarEventTransaction())
->setTransactionType(
PhabricatorCalendarEventTransaction::TYPE_START_DATE)
- ->setNewValue($start_value->getEpoch());
+ ->setNewValue($start_value);
$xactions[] = id(new PhabricatorCalendarEventTransaction())
->setTransactionType(
PhabricatorCalendarEventTransaction::TYPE_END_DATE)
- ->setNewValue($end_value->getEpoch());
+ ->setNewValue($end_value);
}
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditProController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditProController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventEditProController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditProController.php
@@ -1,7 +1,7 @@
<?php
final class PhabricatorCalendarEventEditProController
- extends ManiphestController {
+ extends PhabricatorCalendarController {
public function handleRequest(AphrontRequest $request) {
return id(new PhabricatorCalendarEditEngine())
diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
@@ -85,9 +85,9 @@
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
- return $object->getIsRecurring();
+ return (int)$object->getIsRecurring();
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
- return $object->getRecurrenceFrequency();
+ return $object->getFrequencyUnit();
case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE:
return $object->getRecurrenceEndDate();
case PhabricatorCalendarEventTransaction::TYPE_NAME:
@@ -120,7 +120,6 @@
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
case PhabricatorCalendarEventTransaction::TYPE_NAME:
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
@@ -132,11 +131,12 @@
case PhabricatorCalendarEventTransaction::TYPE_DECLINE:
return PhabricatorCalendarEventInvitee::STATUS_DECLINED;
case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY:
+ case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
return (int)$xaction->getNewValue();
case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE:
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
- return $xaction->getNewValue();
+ return $xaction->getNewValue()->getEpoch();
case PhabricatorCalendarEventTransaction::TYPE_INVITE:
$status_invited = PhabricatorCalendarEventInvitee::STATUS_INVITED;
$status_uninvited = PhabricatorCalendarEventInvitee::STATUS_UNINVITED;
@@ -187,9 +187,12 @@
switch ($xaction->getTransactionType()) {
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
- return $object->setIsRecurring($xaction->getNewValue());
+ return $object->setIsRecurring((int)$xaction->getNewValue());
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
- return $object->setRecurrenceFrequency($xaction->getNewValue());
+ return $object->setRecurrenceFrequency(
+ array(
+ 'rule' => $xaction->getNewValue(),
+ ));
case PhabricatorCalendarEventTransaction::TYPE_NAME:
$object->setName($xaction->getNewValue());
return;
@@ -370,11 +373,11 @@
foreach ($xactions as $xaction) {
if ($xaction->getTransactionType() == $start_date_xaction) {
- $start_date = $xaction->getNewValue();
+ $start_date = $xaction->getNewValue()->getEpoch();
} else if ($xaction->getTransactionType() == $end_date_xaction) {
- $end_date = $xaction->getNewValue();
+ $end_date = $xaction->getNewValue()->getEpoch();
} else if ($xaction->getTransactionType() == $recurrence_end_xaction) {
- $recurrence_end = $xaction->getNewValue();
+ $recurrence_end = $xaction->getNewValue()->getEpoch();
} else if ($xaction->getTransactionType() == $is_recurrence_xaction) {
$is_recurring = $xaction->getNewValue();
}
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
@@ -265,8 +265,13 @@
$this->renderHandleLink($author_phid));
return $text;
case self::TYPE_FREQUENCY:
+ $rule = $new;
+ if (is_array($rule)) {
+ $rule = idx($rule, 'rule');
+ }
+
$text = '';
- switch ($new['rule']) {
+ switch ($rule) {
case PhabricatorCalendarEvent::FREQUENCY_DAILY:
$text = pht('%s set this event to repeat daily.',
$this->renderHandleLink($author_phid));
@@ -487,8 +492,13 @@
$this->renderHandleLink($object_phid));
return $text;
case self::TYPE_FREQUENCY:
+ $rule = $new;
+ if (is_array($rule)) {
+ $rule = idx($rule, 'rule');
+ }
+
$text = '';
- switch ($new['rule']) {
+ switch ($rule) {
case PhabricatorCalendarEvent::FREQUENCY_DAILY:
$text = pht('%s set %s to repeat daily.',
$this->renderHandleLink($author_phid),
diff --git a/src/applications/transactions/editfield/PhabricatorEpochEditField.php b/src/applications/transactions/editfield/PhabricatorEpochEditField.php
--- a/src/applications/transactions/editfield/PhabricatorEpochEditField.php
+++ b/src/applications/transactions/editfield/PhabricatorEpochEditField.php
@@ -21,7 +21,8 @@
}
protected function newHTTPParameterType() {
- return new AphrontEpochHTTPParameterType();
+ return id(new AphrontEpochHTTPParameterType())
+ ->setAllowNull($this->getAllowNull());
}
protected function newConduitParameterType() {

File Metadata

Mime Type
text/plain
Expires
Tue, May 21, 2:58 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6289026
Default Alt Text
D16282.diff (9 KB)

Event Timeline