diff --git a/src/applications/paste/editor/PhabricatorPasteEditEngine.php b/src/applications/paste/editor/PhabricatorPasteEditEngine.php --- a/src/applications/paste/editor/PhabricatorPasteEditEngine.php +++ b/src/applications/paste/editor/PhabricatorPasteEditEngine.php @@ -83,6 +83,14 @@ ->setMonospaced(true) ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) ->setValue($object->getRawContent()), + id(new PhabricatorSelectEditField()) + ->setKey('status') + ->setLabel(pht('Status')) + ->setDescription(pht('Active or archive the paste.')) + ->setTransactionType(PhabricatorPasteTransaction::TYPE_STATUS) + ->setIsConduitOnly(true) + ->setValue($object->getStatus()) + ->setOptions(PhabricatorPaste::getStatusNameMap()), ); } diff --git a/src/applications/transactions/editfield/PhabricatorEditField.php b/src/applications/transactions/editfield/PhabricatorEditField.php --- a/src/applications/transactions/editfield/PhabricatorEditField.php +++ b/src/applications/transactions/editfield/PhabricatorEditField.php @@ -29,6 +29,7 @@ private $isDefaultable = true; private $isLockable = true; private $isCopyable = false; + private $isConduitOnly = false; public function setKey($key) { $this->key = $key; @@ -111,6 +112,15 @@ return $this->isReorderable; } + public function setIsConduitOnly($is_conduit_only) { + $this->isConduitOnly = $is_conduit_only; + return $this; + } + + public function getIsConduitOnly() { + return $this->isConduitOnly; + } + public function setIsEditDefaults($is_edit_defaults) { $this->isEditDefaults = $is_edit_defaults; return $this; @@ -197,6 +207,10 @@ } protected function buildControl() { + if ($this->getIsConduitOnly()) { + return null; + } + $control = $this->newControl(); if ($control === null) { return null; @@ -466,6 +480,10 @@ } final public function getHTTPParameterType() { + if ($this->getIsConduitOnly()) { + return null; + } + $type = $this->newHTTPParameterType(); if ($type) { @@ -492,8 +510,16 @@ } protected function newEditType() { + // TODO: This could be a little cleaner. + $http_type = $this->getHTTPParameterType(); + if ($http_type) { + $value_type = $http_type->getTypeName(); + } else { + $value_type = 'wild'; + } + return id(new PhabricatorSimpleEditType()) - ->setValueType($this->getHTTPParameterType()->getTypeName()); + ->setValueType($value_type); } protected function getEditType() { @@ -523,6 +549,10 @@ } public function getWebEditTypes() { + if ($this->getIsConduitOnly()) { + return array(); + } + $edit_type = $this->getEditType(); if ($edit_type === null) {