mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 05:12:41 +01:00
Allow pastes to be activated/archived via Conduit
Summary: Ref T9964. Add a `setIsConduitOnly()` method so we can mark a field as API-only. Test Plan: - Created and edited pastes via web UI (no status field). - Adjusted status via web UI action. - Adjusted status via Conduit API. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9964 Differential Revision: https://secure.phabricator.com/D14788
This commit is contained in:
parent
ab748e522a
commit
a8b402aa14
2 changed files with 39 additions and 1 deletions
|
@ -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()),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue