diff --git a/src/applications/paste/editor/PhabricatorPasteEditEngine.php b/src/applications/paste/editor/PhabricatorPasteEditEngine.php index b0a2fed288..972c46b099 100644 --- a/src/applications/paste/editor/PhabricatorPasteEditEngine.php +++ b/src/applications/paste/editor/PhabricatorPasteEditEngine.php @@ -83,6 +83,14 @@ final class PhabricatorPasteEditEngine ->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 index 4796c51467..44807de725 100644 --- a/src/applications/transactions/editfield/PhabricatorEditField.php +++ b/src/applications/transactions/editfield/PhabricatorEditField.php @@ -29,6 +29,7 @@ abstract class PhabricatorEditField extends Phobject { private $isDefaultable = true; private $isLockable = true; private $isCopyable = false; + private $isConduitOnly = false; public function setKey($key) { $this->key = $key; @@ -111,6 +112,15 @@ abstract class PhabricatorEditField extends Phobject { 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 @@ abstract class PhabricatorEditField extends Phobject { } protected function buildControl() { + if ($this->getIsConduitOnly()) { + return null; + } + $control = $this->newControl(); if ($control === null) { return null; @@ -466,6 +480,10 @@ abstract class PhabricatorEditField extends Phobject { } final public function getHTTPParameterType() { + if ($this->getIsConduitOnly()) { + return null; + } + $type = $this->newHTTPParameterType(); if ($type) { @@ -492,8 +510,16 @@ abstract class PhabricatorEditField extends Phobject { } 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 @@ abstract class PhabricatorEditField extends Phobject { } public function getWebEditTypes() { + if ($this->getIsConduitOnly()) { + return array(); + } + $edit_type = $this->getEditType(); if ($edit_type === null) {