1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Support "date" custom fields in "*.edit" endpoints

Summary: Fixes T13355. This didn't appear to be a ton of extra work, we just didn't get it for free in the original implementation in D14635.

Test Plan:
  - Saw "date" custom fields appear in Conduit API documentation for "maniphest.edit".
  - Set custom "date" field to null and non-null values via the API.

{F6666582}

Maniphest Tasks: T13355

Differential Revision: https://secure.phabricator.com/D20690
This commit is contained in:
epriestley 2019-07-31 12:40:56 -07:00
parent 76cd181bf3
commit 8e263a2f64
3 changed files with 20 additions and 9 deletions

View file

@ -3,8 +3,24 @@
final class ConduitEpochParameterType
extends ConduitParameterType {
private $allowNull;
public function setAllowNull($allow_null) {
$this->allowNull = $allow_null;
return $this;
}
public function getAllowNull() {
return $this->allowNull;
}
protected function getParameterValue(array $request, $key, $strict) {
$value = parent::getParameterValue($request, $key, $strict);
if ($this->allowNull && ($value === null)) {
return $value;
}
$value = $this->parseIntValue($request, $key, $value, $strict);
if ($value <= 0) {

View file

@ -37,7 +37,8 @@ final class PhabricatorEpochEditField
}
protected function newConduitParameterType() {
return new ConduitEpochParameterType();
return id(new ConduitEpochParameterType())
->setAllowNull($this->getAllowNull());
}
}

View file

@ -226,20 +226,14 @@ final class PhabricatorStandardCustomFieldDate
}
}
public function shouldAppearInConduitTransactions() {
// TODO: Dates are complicated and we don't yet support handling them from
// Conduit.
return false;
}
protected function newConduitSearchParameterType() {
// TODO: Build a new "pair<epoch|null, epoch|null>" type or similar.
return null;
}
protected function newConduitEditParameterType() {
return new ConduitEpochParameterType();
return id(new ConduitEpochParameterType())
->setAllowNull(!$this->getRequired());
}
protected function newExportFieldType() {