diff --git a/src/applications/differential/customfield/DifferentialAuditorsField.php b/src/applications/differential/customfield/DifferentialAuditorsField.php --- a/src/applications/differential/customfield/DifferentialAuditorsField.php +++ b/src/applications/differential/customfield/DifferentialAuditorsField.php @@ -16,7 +16,7 @@ } public function getValueForStorage() { - return json_encode($this->getValue()); + return phutil_json_encode($this->getValue()); } public function setValueFromStorage($value) { @@ -28,33 +28,16 @@ return $this; } - public function shouldAppearInCommitMessage() { - return true; - } - - public function shouldAllowEditInCommitMessage() { - return true; - } - public function canDisableField() { return false; } - public function getRequiredHandlePHIDsForCommitMessage() { - return nonempty($this->getValue(), array()); - } - - public function parseCommitMessageValue($value) { - return $this->parseObjectList( - $value, - array( - PhabricatorPeopleUserPHIDType::TYPECONST, - PhabricatorProjectProjectPHIDType::TYPECONST, - )); + public function shouldAppearInEditEngine() { + return true; } - public function renderCommitMessageValue(array $handles) { - return $this->renderObjectList($handles); + public function shouldAppearInCommitMessage() { + return true; } public function shouldAppearInConduitTransactions() { @@ -65,4 +48,8 @@ return new ConduitPHIDListParameterType(); } + public function shouldAppearInApplicationTransactions() { + return true; + } + } diff --git a/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php b/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php --- a/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php +++ b/src/applications/differential/field/DifferentialAuditorsCommitMessageField.php @@ -22,6 +22,14 @@ return 'phabricator:auditors'; } + public function isFieldEditable() { + return true; + } + + public function isTemplateField() { + return false; + } + public function readFieldValueFromConduit($value) { return $this->readStringListFieldValueFromConduit($value); } diff --git a/src/applications/differential/field/DifferentialCommitMessageField.php b/src/applications/differential/field/DifferentialCommitMessageField.php --- a/src/applications/differential/field/DifferentialCommitMessageField.php +++ b/src/applications/differential/field/DifferentialCommitMessageField.php @@ -182,7 +182,7 @@ protected function isCustomFieldEnabled($key) { $field_list = PhabricatorCustomField::getObjectFields( new DifferentialRevision(), - PhabricatorCustomField::ROLE_VIEW); + DifferentialCustomField::ROLE_COMMITMESSAGE); $fields = $field_list->getFields(); return isset($fields[$key]); diff --git a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php --- a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php +++ b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php @@ -37,6 +37,10 @@ } protected function buildControl() { + if ($this->getIsConduitOnly()) { + return null; + } + $field = $this->getCustomField(); $clone = clone $field; diff --git a/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php b/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php --- a/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php +++ b/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php @@ -31,7 +31,7 @@ $field_list = PhabricatorCustomField::getObjectFields( $object, - PhabricatorCustomField::ROLE_EDIT); + PhabricatorCustomField::ROLE_EDITENGINE); $field_list->setViewer($viewer); diff --git a/src/infrastructure/customfield/field/PhabricatorCustomField.php b/src/infrastructure/customfield/field/PhabricatorCustomField.php --- a/src/infrastructure/customfield/field/PhabricatorCustomField.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php @@ -33,6 +33,7 @@ const ROLE_GLOBALSEARCH = 'GlobalSearch'; const ROLE_CONDUIT = 'conduit'; const ROLE_HERALD = 'herald'; + const ROLE_EDITENGINE = 'EditEngine'; /* -( Building Applications with Custom Fields )--------------------------- */ @@ -292,6 +293,9 @@ return $this->shouldAppearInTransactionMail(); case self::ROLE_HERALD: return $this->shouldAppearInHerald(); + case self::ROLE_EDITENGINE: + return $this->shouldAppearInEditView() || + $this->shouldAppearInEditEngine(); case self::ROLE_DEFAULT: return true; default: @@ -1120,12 +1124,19 @@ return $this->proxy->newStandardEditField(); } + if (!$this->shouldAppearInEditView()) { + $conduit_only = true; + } else { + $conduit_only = false; + } + return $this->newEditField() ->setKey($this->getFieldKey()) ->setEditTypeKey($this->getModernFieldKey()) ->setLabel($this->getFieldName()) ->setDescription($this->getFieldDescription()) ->setTransactionType($this->getApplicationTransactionType()) + ->setIsConduitOnly($conduit_only) ->setValue($this->getNewValueForApplicationTransactions()); } @@ -1146,6 +1157,16 @@ return false; } + /** + * @task edit + */ + public function shouldAppearInEditEngine() { + if ($this->proxy) { + return $this->proxy->shouldAppearInEditEngine(); + } + return false; + } + /** * @task edit