Page MenuHomePhabricator

D8450.id20113.diff
No OneTemporary

D8450.id20113.diff

diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
--- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
+++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
@@ -12,8 +12,61 @@
}
public function getOptions() {
+ $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
+
+ $fields = array(
+ new DifferentialTitleField(),
+ new DifferentialSummaryField(),
+ new DifferentialTestPlanField(),
+ new DifferentialAuthorField(),
+ new DifferentialReviewersField(),
+ new DifferentialProjectReviewersField(),
+ new DifferentialReviewedByField(),
+ new DifferentialSubscribersField(),
+ new DifferentialRepositoryField(),
+ new DifferentialLintField(),
+ new DifferentialUnitField(),
+ new DifferentialViewPolicyField(),
+ new DifferentialEditPolicyField(),
+
+ new DifferentialDependsOnField(),
+ new DifferentialDependenciesField(),
+ new DifferentialManiphestTasksField(),
+ new DifferentialCommitsField(),
+
+ new DifferentialJIRAIssuesField(),
+ new DifferentialAsanaRepresentationField(),
+
+ new DifferentialBlameRevisionField(),
+ new DifferentialPathField(),
+ new DifferentialHostField(),
+ new DifferentialRevertPlanField(),
+
+ new DifferentialApplyPatchField(),
+
+ new DifferentialRevisionIDField(),
+ );
+
+ $default_fields = array();
+ foreach ($fields as $field) {
+ $default_fields[$field->getFieldKey()] = array(
+ 'disabled' => $field->shouldDisableByDefault(),
+ );
+ }
+
return array(
$this->newOption(
+ 'differential.fields',
+ $custom_field_type,
+ $default_fields)
+ ->setCustomData(
+ id(new DifferentialRevision())->getCustomFieldBaseClass())
+ ->setDescription(
+ pht(
+ "Select and reorder revision fields.\n\n".
+ "NOTE: This feature is under active development and subject ".
+ "to change.")),
+ $this->newOption(
'differential.whitespace-matters',
'list<regex>',
array(
diff --git a/src/applications/differential/customfield/DifferentialAsanaRepresentationField.php b/src/applications/differential/customfield/DifferentialAsanaRepresentationField.php
--- a/src/applications/differential/customfield/DifferentialAsanaRepresentationField.php
+++ b/src/applications/differential/customfield/DifferentialAsanaRepresentationField.php
@@ -11,6 +11,10 @@
return pht('In Asana');
}
+ public function canDisableField() {
+ return false;
+ }
+
public function getFieldDescription() {
return pht('Shows revision representation in Asana.');
}
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
@@ -32,6 +32,10 @@
return true;
}
+ public function canDisableField() {
+ return false;
+ }
+
public function getRequiredHandlePHIDsForCommitMessage() {
return nonempty($this->getValue(), array());
}
diff --git a/src/applications/differential/customfield/DifferentialAuthorField.php b/src/applications/differential/customfield/DifferentialAuthorField.php
--- a/src/applications/differential/customfield/DifferentialAuthorField.php
+++ b/src/applications/differential/customfield/DifferentialAuthorField.php
@@ -15,6 +15,10 @@
return pht('Stores the revision author.');
}
+ public function canDisableField() {
+ return false;
+ }
+
public function shouldAppearInPropertyView() {
return true;
}
diff --git a/src/applications/differential/customfield/DifferentialBlameRevisionField.php b/src/applications/differential/customfield/DifferentialBlameRevisionField.php
--- a/src/applications/differential/customfield/DifferentialBlameRevisionField.php
+++ b/src/applications/differential/customfield/DifferentialBlameRevisionField.php
@@ -107,7 +107,7 @@
);
}
- public function renderCommitMessageValue() {
+ public function renderCommitMessageValue(array $handles) {
return $this->getValue();
}
diff --git a/src/applications/differential/customfield/DifferentialCommitsField.php b/src/applications/differential/customfield/DifferentialCommitsField.php
--- a/src/applications/differential/customfield/DifferentialCommitsField.php
+++ b/src/applications/differential/customfield/DifferentialCommitsField.php
@@ -11,6 +11,10 @@
return pht('Commits');
}
+ public function canDisableField() {
+ return false;
+ }
+
public function getFieldDescription() {
return pht('Shows associated commits.');
}
diff --git a/src/applications/differential/customfield/DifferentialDependenciesField.php b/src/applications/differential/customfield/DifferentialDependenciesField.php
--- a/src/applications/differential/customfield/DifferentialDependenciesField.php
+++ b/src/applications/differential/customfield/DifferentialDependenciesField.php
@@ -11,6 +11,10 @@
return pht('Dependencies');
}
+ public function canDisableField() {
+ return false;
+ }
+
public function getFieldDescription() {
return pht('Lists revisions this one is depended on by.');
}
diff --git a/src/applications/differential/customfield/DifferentialDependsOnField.php b/src/applications/differential/customfield/DifferentialDependsOnField.php
--- a/src/applications/differential/customfield/DifferentialDependsOnField.php
+++ b/src/applications/differential/customfield/DifferentialDependsOnField.php
@@ -11,6 +11,10 @@
return pht('Depends On');
}
+ public function canDisableField() {
+ return false;
+ }
+
public function getFieldDescription() {
return pht('Lists revisions this one depends on.');
}
diff --git a/src/applications/differential/customfield/DifferentialJIRAIssuesField.php b/src/applications/differential/customfield/DifferentialJIRAIssuesField.php
--- a/src/applications/differential/customfield/DifferentialJIRAIssuesField.php
+++ b/src/applications/differential/customfield/DifferentialJIRAIssuesField.php
@@ -13,6 +13,10 @@
return 'jira.issues';
}
+ public function canDisableField() {
+ return false;
+ }
+
public function getValueForStorage() {
return json_encode($this->getValue());
}
diff --git a/src/applications/differential/customfield/DifferentialManiphestTasksField.php b/src/applications/differential/customfield/DifferentialManiphestTasksField.php
--- a/src/applications/differential/customfield/DifferentialManiphestTasksField.php
+++ b/src/applications/differential/customfield/DifferentialManiphestTasksField.php
@@ -11,6 +11,10 @@
return 'maniphestTaskPHIDs';
}
+ public function canDisableField() {
+ return false;
+ }
+
public function getFieldName() {
return pht('Maniphest Tasks');
}
diff --git a/src/applications/differential/customfield/DifferentialProjectReviewersField.php b/src/applications/differential/customfield/DifferentialProjectReviewersField.php
--- a/src/applications/differential/customfield/DifferentialProjectReviewersField.php
+++ b/src/applications/differential/customfield/DifferentialProjectReviewersField.php
@@ -19,6 +19,10 @@
return true;
}
+ public function canDisableField() {
+ return false;
+ }
+
public function renderPropertyViewLabel() {
return $this->getFieldName();
}
diff --git a/src/applications/differential/customfield/DifferentialReviewedByField.php b/src/applications/differential/customfield/DifferentialReviewedByField.php
--- a/src/applications/differential/customfield/DifferentialReviewedByField.php
+++ b/src/applications/differential/customfield/DifferentialReviewedByField.php
@@ -27,6 +27,10 @@
return false;
}
+ public function canDisableField() {
+ return true;
+ }
+
protected function readValueFromRevision(
DifferentialRevision $revision) {
diff --git a/src/applications/differential/customfield/DifferentialRevisionIDField.php b/src/applications/differential/customfield/DifferentialRevisionIDField.php
--- a/src/applications/differential/customfield/DifferentialRevisionIDField.php
+++ b/src/applications/differential/customfield/DifferentialRevisionIDField.php
@@ -4,6 +4,10 @@
extends DifferentialCustomField {
public function getFieldKey() {
+ return 'differential:revision-id';
+ }
+
+ public function getFieldKeyForConduit() {
return 'revisionID';
}
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -481,43 +481,7 @@
public function getCustomFieldSpecificationForRole($role) {
- $fields = array(
- new DifferentialAuthorField(),
-
- new DifferentialTitleField(),
- new DifferentialSummaryField(),
- new DifferentialTestPlanField(),
- new DifferentialReviewersField(),
- new DifferentialProjectReviewersField(),
- new DifferentialSubscribersField(),
- new DifferentialRepositoryField(),
- new DifferentialViewPolicyField(),
- new DifferentialEditPolicyField(),
-
- new DifferentialDependsOnField(),
- new DifferentialDependenciesField(),
- new DifferentialManiphestTasksField(),
- new DifferentialCommitsField(),
-
- new DifferentialJIRAIssuesField(),
- new DifferentialAsanaRepresentationField(),
-
- new DifferentialBlameRevisionField(),
- new DifferentialPathField(),
- new DifferentialHostField(),
- new DifferentialRevertPlanField(),
-
- new DifferentialApplyPatchField(),
- );
-
- $result = array();
- foreach ($fields as $field) {
- $result[$field->getFieldKey()] = array(
- 'disabled' => $field->shouldDisableByDefault(),
- );
- }
-
- return $result;
+ return PhabricatorEnv::getEnvConfig('differential.fields');
}
public function getCustomFieldBaseClass() {

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 12, 9:58 PM (6 d, 16 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6719416
Default Alt Text
D8450.id20113.diff (10 KB)

Event Timeline