Differential D17107 Diff 41166 src/applications/differential/editor/DifferentialRevisionEditEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialRevisionEditEngine.php
| Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | public function setDiff(DifferentialDiff $diff) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getDiff() { | public function getDiff() { | ||||
| return $this->diff; | return $this->diff; | ||||
| } | } | ||||
| protected function buildCustomEditFields($object) { | protected function buildCustomEditFields($object) { | ||||
| $viewer = $this->getViewer(); | |||||
| $plan_required = PhabricatorEnv::getEnvConfig( | $plan_required = PhabricatorEnv::getEnvConfig( | ||||
| 'differential.require-test-plan-field'); | 'differential.require-test-plan-field'); | ||||
| $plan_enabled = $this->isCustomFieldEnabled( | $plan_enabled = $this->isCustomFieldEnabled( | ||||
| $object, | $object, | ||||
| 'differential:test-plan'); | 'differential:test-plan'); | ||||
| $diff = $this->getDiff(); | $diff = $this->getDiff(); | ||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | protected function buildCustomEditFields($object) { | ||||
| $fields[] = id(new PhabricatorDatasourceEditField()) | $fields[] = id(new PhabricatorDatasourceEditField()) | ||||
| ->setKey(DifferentialRevisionReviewersTransaction::EDITKEY) | ->setKey(DifferentialRevisionReviewersTransaction::EDITKEY) | ||||
| ->setLabel(pht('Reviewers')) | ->setLabel(pht('Reviewers')) | ||||
| ->setDatasource(new DifferentialReviewerDatasource()) | ->setDatasource(new DifferentialReviewerDatasource()) | ||||
| ->setUseEdgeTransactions(true) | ->setUseEdgeTransactions(true) | ||||
| ->setTransactionType( | ->setTransactionType( | ||||
| DifferentialRevisionReviewersTransaction::TRANSACTIONTYPE) | DifferentialRevisionReviewersTransaction::TRANSACTIONTYPE) | ||||
| ->setCommentActionLabel(pht('Edit Reviewers')) | ->setCommentActionLabel(pht('Change Reviewers')) | ||||
| ->setDescription(pht('Reviewers for this revision.')) | ->setDescription(pht('Reviewers for this revision.')) | ||||
| ->setConduitDescription(pht('Change the reviewers for this revision.')) | ->setConduitDescription(pht('Change the reviewers for this revision.')) | ||||
| ->setConduitTypeDescription(pht('New reviewers.')) | ->setConduitTypeDescription(pht('New reviewers.')) | ||||
| ->setValue($object->getReviewerPHIDsForEdit()); | ->setValue($object->getReviewerPHIDsForEdit()); | ||||
| $fields[] = id(new PhabricatorDatasourceEditField()) | $fields[] = id(new PhabricatorDatasourceEditField()) | ||||
| ->setKey('repositoryPHID') | ->setKey('repositoryPHID') | ||||
| ->setLabel(pht('Repository')) | ->setLabel(pht('Repository')) | ||||
| Show All 15 Lines | $fields[] = id(new PhabricatorHandlesEditField()) | ||||
| ->setMetadataValue( | ->setMetadataValue( | ||||
| 'edge:type', | 'edge:type', | ||||
| DifferentialRevisionHasTaskEdgeType::EDGECONST) | DifferentialRevisionHasTaskEdgeType::EDGECONST) | ||||
| ->setDescription(pht('Tasks associated with this revision.')) | ->setDescription(pht('Tasks associated with this revision.')) | ||||
| ->setConduitDescription(pht('Change associated tasks.')) | ->setConduitDescription(pht('Change associated tasks.')) | ||||
| ->setConduitTypeDescription(pht('List of tasks.')) | ->setConduitTypeDescription(pht('List of tasks.')) | ||||
| ->setValue(array()); | ->setValue(array()); | ||||
| $actions = DifferentialRevisionActionTransaction::loadAllActions(); | |||||
| foreach ($actions as $key => $action) { | |||||
| $fields[] = $action->newEditField($object, $viewer); | |||||
| } | |||||
| return $fields; | return $fields; | ||||
| } | } | ||||
| private function isCustomFieldEnabled(DifferentialRevision $revision, $key) { | private function isCustomFieldEnabled(DifferentialRevision $revision, $key) { | ||||
| $field_list = PhabricatorCustomField::getObjectFields( | $field_list = PhabricatorCustomField::getObjectFields( | ||||
| $revision, | $revision, | ||||
| PhabricatorCustomField::ROLE_VIEW); | PhabricatorCustomField::ROLE_VIEW); | ||||
| $fields = $field_list->getFields(); | $fields = $field_list->getFields(); | ||||
| return isset($fields[$key]); | return isset($fields[$key]); | ||||
| } | } | ||||
| } | } | ||||