@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow configuration of Differential custom fields

Summary: Ref T2222. Ref T3886. This is a little early for general use, but the message parse/generate stuff requires CustomFields and FieldSpecifications to be closely aligned, so this provides at least a plausbile approach for any installs that run into trouble.

Test Plan: Viewed config; reordered fields.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2222, T3886

Differential Revision: https://secure.phabricator.com/D8450

+99 -38
+53
src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
··· 12 12 } 13 13 14 14 public function getOptions() { 15 + $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType'; 16 + 17 + $fields = array( 18 + new DifferentialTitleField(), 19 + new DifferentialSummaryField(), 20 + new DifferentialTestPlanField(), 21 + new DifferentialAuthorField(), 22 + new DifferentialReviewersField(), 23 + new DifferentialProjectReviewersField(), 24 + new DifferentialReviewedByField(), 25 + new DifferentialSubscribersField(), 26 + new DifferentialRepositoryField(), 27 + new DifferentialLintField(), 28 + new DifferentialUnitField(), 29 + new DifferentialViewPolicyField(), 30 + new DifferentialEditPolicyField(), 31 + 32 + new DifferentialDependsOnField(), 33 + new DifferentialDependenciesField(), 34 + new DifferentialManiphestTasksField(), 35 + new DifferentialCommitsField(), 36 + 37 + new DifferentialJIRAIssuesField(), 38 + new DifferentialAsanaRepresentationField(), 39 + 40 + new DifferentialBlameRevisionField(), 41 + new DifferentialPathField(), 42 + new DifferentialHostField(), 43 + new DifferentialRevertPlanField(), 44 + 45 + new DifferentialApplyPatchField(), 46 + 47 + new DifferentialRevisionIDField(), 48 + ); 49 + 50 + $default_fields = array(); 51 + foreach ($fields as $field) { 52 + $default_fields[$field->getFieldKey()] = array( 53 + 'disabled' => $field->shouldDisableByDefault(), 54 + ); 55 + } 56 + 15 57 return array( 58 + $this->newOption( 59 + 'differential.fields', 60 + $custom_field_type, 61 + $default_fields) 62 + ->setCustomData( 63 + id(new DifferentialRevision())->getCustomFieldBaseClass()) 64 + ->setDescription( 65 + pht( 66 + "Select and reorder revision fields.\n\n". 67 + "NOTE: This feature is under active development and subject ". 68 + "to change.")), 16 69 $this->newOption( 17 70 'differential.whitespace-matters', 18 71 'list<regex>',
+4
src/applications/differential/customfield/DifferentialAsanaRepresentationField.php
··· 11 11 return pht('In Asana'); 12 12 } 13 13 14 + public function canDisableField() { 15 + return false; 16 + } 17 + 14 18 public function getFieldDescription() { 15 19 return pht('Shows revision representation in Asana.'); 16 20 }
+4
src/applications/differential/customfield/DifferentialAuditorsField.php
··· 32 32 return true; 33 33 } 34 34 35 + public function canDisableField() { 36 + return false; 37 + } 38 + 35 39 public function getRequiredHandlePHIDsForCommitMessage() { 36 40 return nonempty($this->getValue(), array()); 37 41 }
+4
src/applications/differential/customfield/DifferentialAuthorField.php
··· 15 15 return pht('Stores the revision author.'); 16 16 } 17 17 18 + public function canDisableField() { 19 + return false; 20 + } 21 + 18 22 public function shouldAppearInPropertyView() { 19 23 return true; 20 24 }
+1 -1
src/applications/differential/customfield/DifferentialBlameRevisionField.php
··· 107 107 ); 108 108 } 109 109 110 - public function renderCommitMessageValue() { 110 + public function renderCommitMessageValue(array $handles) { 111 111 return $this->getValue(); 112 112 } 113 113
+4
src/applications/differential/customfield/DifferentialCommitsField.php
··· 11 11 return pht('Commits'); 12 12 } 13 13 14 + public function canDisableField() { 15 + return false; 16 + } 17 + 14 18 public function getFieldDescription() { 15 19 return pht('Shows associated commits.'); 16 20 }
+4
src/applications/differential/customfield/DifferentialDependenciesField.php
··· 11 11 return pht('Dependencies'); 12 12 } 13 13 14 + public function canDisableField() { 15 + return false; 16 + } 17 + 14 18 public function getFieldDescription() { 15 19 return pht('Lists revisions this one is depended on by.'); 16 20 }
+4
src/applications/differential/customfield/DifferentialDependsOnField.php
··· 11 11 return pht('Depends On'); 12 12 } 13 13 14 + public function canDisableField() { 15 + return false; 16 + } 17 + 14 18 public function getFieldDescription() { 15 19 return pht('Lists revisions this one depends on.'); 16 20 }
+4
src/applications/differential/customfield/DifferentialJIRAIssuesField.php
··· 13 13 return 'jira.issues'; 14 14 } 15 15 16 + public function canDisableField() { 17 + return false; 18 + } 19 + 16 20 public function getValueForStorage() { 17 21 return json_encode($this->getValue()); 18 22 }
+4
src/applications/differential/customfield/DifferentialManiphestTasksField.php
··· 11 11 return 'maniphestTaskPHIDs'; 12 12 } 13 13 14 + public function canDisableField() { 15 + return false; 16 + } 17 + 14 18 public function getFieldName() { 15 19 return pht('Maniphest Tasks'); 16 20 }
+4
src/applications/differential/customfield/DifferentialProjectReviewersField.php
··· 19 19 return true; 20 20 } 21 21 22 + public function canDisableField() { 23 + return false; 24 + } 25 + 22 26 public function renderPropertyViewLabel() { 23 27 return $this->getFieldName(); 24 28 }
+4
src/applications/differential/customfield/DifferentialReviewedByField.php
··· 27 27 return false; 28 28 } 29 29 30 + public function canDisableField() { 31 + return true; 32 + } 33 + 30 34 protected function readValueFromRevision( 31 35 DifferentialRevision $revision) { 32 36
+4
src/applications/differential/customfield/DifferentialRevisionIDField.php
··· 4 4 extends DifferentialCustomField { 5 5 6 6 public function getFieldKey() { 7 + return 'differential:revision-id'; 8 + } 9 + 10 + public function getFieldKeyForConduit() { 7 11 return 'revisionID'; 8 12 } 9 13
+1 -37
src/applications/differential/storage/DifferentialRevision.php
··· 481 481 482 482 483 483 public function getCustomFieldSpecificationForRole($role) { 484 - $fields = array( 485 - new DifferentialAuthorField(), 486 - 487 - new DifferentialTitleField(), 488 - new DifferentialSummaryField(), 489 - new DifferentialTestPlanField(), 490 - new DifferentialReviewersField(), 491 - new DifferentialProjectReviewersField(), 492 - new DifferentialSubscribersField(), 493 - new DifferentialRepositoryField(), 494 - new DifferentialViewPolicyField(), 495 - new DifferentialEditPolicyField(), 496 - 497 - new DifferentialDependsOnField(), 498 - new DifferentialDependenciesField(), 499 - new DifferentialManiphestTasksField(), 500 - new DifferentialCommitsField(), 501 - 502 - new DifferentialJIRAIssuesField(), 503 - new DifferentialAsanaRepresentationField(), 504 - 505 - new DifferentialBlameRevisionField(), 506 - new DifferentialPathField(), 507 - new DifferentialHostField(), 508 - new DifferentialRevertPlanField(), 509 - 510 - new DifferentialApplyPatchField(), 511 - ); 512 - 513 - $result = array(); 514 - foreach ($fields as $field) { 515 - $result[$field->getFieldKey()] = array( 516 - 'disabled' => $field->shouldDisableByDefault(), 517 - ); 518 - } 519 - 520 - return $result; 484 + return PhabricatorEnv::getEnvConfig('differential.fields'); 521 485 } 522 486 523 487 public function getCustomFieldBaseClass() {