mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
Simplify Auditors custom field in Differential
Summary: Ref T11114. This field just stores the value of "Auditors" so you can trigger auditors explicitly later on if you want. Test Plan: Created and edited revisions with "Auditors". Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17070
This commit is contained in:
parent
d12856b5d4
commit
914d9fa8b9
6 changed files with 44 additions and 24 deletions
|
@ -16,7 +16,7 @@ final class DifferentialAuditorsField
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getValueForStorage() {
|
public function getValueForStorage() {
|
||||||
return json_encode($this->getValue());
|
return phutil_json_encode($this->getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setValueFromStorage($value) {
|
public function setValueFromStorage($value) {
|
||||||
|
@ -28,33 +28,16 @@ final class DifferentialAuditorsField
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldAppearInCommitMessage() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function shouldAllowEditInCommitMessage() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function canDisableField() {
|
public function canDisableField() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequiredHandlePHIDsForCommitMessage() {
|
public function shouldAppearInEditEngine() {
|
||||||
return nonempty($this->getValue(), array());
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parseCommitMessageValue($value) {
|
public function shouldAppearInCommitMessage() {
|
||||||
return $this->parseObjectList(
|
return true;
|
||||||
$value,
|
|
||||||
array(
|
|
||||||
PhabricatorPeopleUserPHIDType::TYPECONST,
|
|
||||||
PhabricatorProjectProjectPHIDType::TYPECONST,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function renderCommitMessageValue(array $handles) {
|
|
||||||
return $this->renderObjectList($handles);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldAppearInConduitTransactions() {
|
public function shouldAppearInConduitTransactions() {
|
||||||
|
@ -65,4 +48,8 @@ final class DifferentialAuditorsField
|
||||||
return new ConduitPHIDListParameterType();
|
return new ConduitPHIDListParameterType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function shouldAppearInApplicationTransactions() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,14 @@ final class DifferentialAuditorsCommitMessageField
|
||||||
return 'phabricator:auditors';
|
return 'phabricator:auditors';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isFieldEditable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isTemplateField() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function readFieldValueFromConduit($value) {
|
public function readFieldValueFromConduit($value) {
|
||||||
return $this->readStringListFieldValueFromConduit($value);
|
return $this->readStringListFieldValueFromConduit($value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ abstract class DifferentialCommitMessageField
|
||||||
protected function isCustomFieldEnabled($key) {
|
protected function isCustomFieldEnabled($key) {
|
||||||
$field_list = PhabricatorCustomField::getObjectFields(
|
$field_list = PhabricatorCustomField::getObjectFields(
|
||||||
new DifferentialRevision(),
|
new DifferentialRevision(),
|
||||||
PhabricatorCustomField::ROLE_VIEW);
|
DifferentialCustomField::ROLE_COMMITMESSAGE);
|
||||||
|
|
||||||
$fields = $field_list->getFields();
|
$fields = $field_list->getFields();
|
||||||
return isset($fields[$key]);
|
return isset($fields[$key]);
|
||||||
|
|
|
@ -37,6 +37,10 @@ final class PhabricatorCustomFieldEditField
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildControl() {
|
protected function buildControl() {
|
||||||
|
if ($this->getIsConduitOnly()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$field = $this->getCustomField();
|
$field = $this->getCustomField();
|
||||||
$clone = clone $field;
|
$clone = clone $field;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ final class PhabricatorCustomFieldEditEngineExtension
|
||||||
|
|
||||||
$field_list = PhabricatorCustomField::getObjectFields(
|
$field_list = PhabricatorCustomField::getObjectFields(
|
||||||
$object,
|
$object,
|
||||||
PhabricatorCustomField::ROLE_EDIT);
|
PhabricatorCustomField::ROLE_EDITENGINE);
|
||||||
|
|
||||||
$field_list->setViewer($viewer);
|
$field_list->setViewer($viewer);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ abstract class PhabricatorCustomField extends Phobject {
|
||||||
const ROLE_GLOBALSEARCH = 'GlobalSearch';
|
const ROLE_GLOBALSEARCH = 'GlobalSearch';
|
||||||
const ROLE_CONDUIT = 'conduit';
|
const ROLE_CONDUIT = 'conduit';
|
||||||
const ROLE_HERALD = 'herald';
|
const ROLE_HERALD = 'herald';
|
||||||
|
const ROLE_EDITENGINE = 'EditEngine';
|
||||||
|
|
||||||
|
|
||||||
/* -( Building Applications with Custom Fields )--------------------------- */
|
/* -( Building Applications with Custom Fields )--------------------------- */
|
||||||
|
@ -292,6 +293,9 @@ abstract class PhabricatorCustomField extends Phobject {
|
||||||
return $this->shouldAppearInTransactionMail();
|
return $this->shouldAppearInTransactionMail();
|
||||||
case self::ROLE_HERALD:
|
case self::ROLE_HERALD:
|
||||||
return $this->shouldAppearInHerald();
|
return $this->shouldAppearInHerald();
|
||||||
|
case self::ROLE_EDITENGINE:
|
||||||
|
return $this->shouldAppearInEditView() ||
|
||||||
|
$this->shouldAppearInEditEngine();
|
||||||
case self::ROLE_DEFAULT:
|
case self::ROLE_DEFAULT:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
@ -1120,12 +1124,19 @@ abstract class PhabricatorCustomField extends Phobject {
|
||||||
return $this->proxy->newStandardEditField();
|
return $this->proxy->newStandardEditField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->shouldAppearInEditView()) {
|
||||||
|
$conduit_only = true;
|
||||||
|
} else {
|
||||||
|
$conduit_only = false;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->newEditField()
|
return $this->newEditField()
|
||||||
->setKey($this->getFieldKey())
|
->setKey($this->getFieldKey())
|
||||||
->setEditTypeKey($this->getModernFieldKey())
|
->setEditTypeKey($this->getModernFieldKey())
|
||||||
->setLabel($this->getFieldName())
|
->setLabel($this->getFieldName())
|
||||||
->setDescription($this->getFieldDescription())
|
->setDescription($this->getFieldDescription())
|
||||||
->setTransactionType($this->getApplicationTransactionType())
|
->setTransactionType($this->getApplicationTransactionType())
|
||||||
|
->setIsConduitOnly($conduit_only)
|
||||||
->setValue($this->getNewValueForApplicationTransactions());
|
->setValue($this->getNewValueForApplicationTransactions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1146,6 +1157,16 @@ abstract class PhabricatorCustomField extends Phobject {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @task edit
|
||||||
|
*/
|
||||||
|
public function shouldAppearInEditEngine() {
|
||||||
|
if ($this->proxy) {
|
||||||
|
return $this->proxy->shouldAppearInEditEngine();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @task edit
|
* @task edit
|
||||||
|
|
Loading…
Reference in a new issue