Differential D17067 Diff 41083 src/applications/differential/editor/DifferentialRevisionEditEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialRevisionEditEngine.php
| <?php | <?php | ||||
| final class DifferentialRevisionEditEngine | final class DifferentialRevisionEditEngine | ||||
| extends PhabricatorEditEngine { | extends PhabricatorEditEngine { | ||||
| private $diff; | private $diff; | ||||
| const ENGINECONST = 'differential.revision'; | const ENGINECONST = 'differential.revision'; | ||||
| const KEY_UPDATE = 'update'; | |||||
| public function getEngineName() { | public function getEngineName() { | ||||
| return pht('Revisions'); | return pht('Revisions'); | ||||
| } | } | ||||
| public function getSummaryHeader() { | public function getSummaryHeader() { | ||||
| return pht('Configure Revision Forms'); | return pht('Configure Revision Forms'); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | if ($diff) { | ||||
| $diff_phid = null; | $diff_phid = null; | ||||
| } | } | ||||
| $is_create = $this->getIsCreate(); | $is_create = $this->getIsCreate(); | ||||
| $is_update = ($diff && !$is_create); | $is_update = ($diff && !$is_create); | ||||
| $fields = array(); | $fields = array(); | ||||
| if ($diff || $is_create) { | |||||
| $fields[] = id(new PhabricatorHandlesEditField()) | $fields[] = id(new PhabricatorHandlesEditField()) | ||||
| ->setKey('update') | ->setKey(self::KEY_UPDATE) | ||||
| ->setLabel(pht('Update Diff')) | ->setLabel(pht('Update Diff')) | ||||
| ->setDescription(pht('New diff to create or update the revision with.')) | ->setDescription(pht('New diff to create or update the revision with.')) | ||||
| ->setConduitDescription(pht('Create or update a revision with a diff.')) | ->setConduitDescription(pht('Create or update a revision with a diff.')) | ||||
| ->setConduitTypeDescription(pht('PHID of the diff.')) | ->setConduitTypeDescription(pht('PHID of the diff.')) | ||||
| ->setTransactionType(DifferentialTransaction::TYPE_UPDATE) | ->setTransactionType(DifferentialTransaction::TYPE_UPDATE) | ||||
| ->setHandleParameterType(new AphrontPHIDListHTTPParameterType()) | ->setHandleParameterType(new AphrontPHIDListHTTPParameterType()) | ||||
| ->setSingleValue($diff_phid) | ->setSingleValue($diff_phid) | ||||
| ->setIsConduitOnly(!$diff) | |||||
| ->setIsReorderable(false) | ->setIsReorderable(false) | ||||
| ->setIsDefaultable(false) | ->setIsDefaultable(false) | ||||
| ->setIsInvisible(true) | ->setIsInvisible(true) | ||||
| ->setIsLockable(false); | ->setIsLockable(false); | ||||
| } | |||||
| if ($is_update) { | if ($is_update) { | ||||
| $fields[] = id(new PhabricatorInstructionsEditField()) | $fields[] = id(new PhabricatorInstructionsEditField()) | ||||
| ->setKey('update.help') | ->setKey('update.help') | ||||
| ->setValue(pht('Describe the updates you have made to the diff.')); | ->setValue(pht('Describe the updates you have made to the diff.')); | ||||
| $fields[] = id(new PhabricatorCommentEditField()) | $fields[] = id(new PhabricatorCommentEditField()) | ||||
| ->setKey('update.comment') | ->setKey('update.comment') | ||||
| ->setLabel(pht('Comment')) | ->setLabel(pht('Comment')) | ||||
| ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) | ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) | ||||
| ->setIsWebOnly(true) | ->setIsWebOnly(true) | ||||
| ->setDescription(pht('Comments providing context for the update.')); | ->setDescription(pht('Comments providing context for the update.')); | ||||
| $fields[] = id(new PhabricatorSubmitEditField()) | $fields[] = id(new PhabricatorSubmitEditField()) | ||||
| ->setKey('update.submit') | ->setKey('update.submit') | ||||
| ->setValue($this->getObjectEditButtonText($object)); | ->setValue($this->getObjectEditButtonText($object)); | ||||
| $fields[] = id(new PhabricatorDividerEditField()) | $fields[] = id(new PhabricatorDividerEditField()) | ||||
| ->setKey('update.note'); | ->setKey('update.note'); | ||||
| } | } | ||||
| $fields[] = id(new PhabricatorTextEditField()) | $fields[] = id(new PhabricatorTextEditField()) | ||||
| ->setKey('title') | ->setKey(DifferentialRevisionTitleTransaction::EDITKEY) | ||||
| ->setLabel(pht('Title')) | ->setLabel(pht('Title')) | ||||
| ->setIsRequired(true) | ->setIsRequired(true) | ||||
| ->setTransactionType( | ->setTransactionType( | ||||
| DifferentialRevisionTitleTransaction::TRANSACTIONTYPE) | DifferentialRevisionTitleTransaction::TRANSACTIONTYPE) | ||||
| ->setDescription(pht('The title of the revision.')) | ->setDescription(pht('The title of the revision.')) | ||||
| ->setConduitDescription(pht('Retitle the revision.')) | ->setConduitDescription(pht('Retitle the revision.')) | ||||
| ->setConduitTypeDescription(pht('New revision title.')) | ->setConduitTypeDescription(pht('New revision title.')) | ||||
| ->setValue($object->getTitle()); | ->setValue($object->getTitle()); | ||||
| $fields[] = id(new PhabricatorRemarkupEditField()) | $fields[] = id(new PhabricatorRemarkupEditField()) | ||||
| ->setKey('summary') | ->setKey(DifferentialRevisionSummaryTransaction::EDITKEY) | ||||
| ->setLabel(pht('Summary')) | ->setLabel(pht('Summary')) | ||||
| ->setTransactionType( | ->setTransactionType( | ||||
| DifferentialRevisionSummaryTransaction::TRANSACTIONTYPE) | DifferentialRevisionSummaryTransaction::TRANSACTIONTYPE) | ||||
| ->setDescription(pht('The summary of the revision.')) | ->setDescription(pht('The summary of the revision.')) | ||||
| ->setConduitDescription(pht('Change the revision summary.')) | ->setConduitDescription(pht('Change the revision summary.')) | ||||
| ->setConduitTypeDescription(pht('New revision summary.')) | ->setConduitTypeDescription(pht('New revision summary.')) | ||||
| ->setValue($object->getSummary()); | ->setValue($object->getSummary()); | ||||
| if ($plan_enabled) { | if ($plan_enabled) { | ||||
| $fields[] = id(new PhabricatorRemarkupEditField()) | $fields[] = id(new PhabricatorRemarkupEditField()) | ||||
| ->setKey('testPlan') | ->setKey(DifferentialRevisionTestPlanTransaction::EDITKEY) | ||||
| ->setLabel(pht('Test Plan')) | ->setLabel(pht('Test Plan')) | ||||
| ->setIsRequired($plan_required) | ->setIsRequired($plan_required) | ||||
| ->setTransactionType( | ->setTransactionType( | ||||
| DifferentialRevisionTestPlanTransaction::TRANSACTIONTYPE) | DifferentialRevisionTestPlanTransaction::TRANSACTIONTYPE) | ||||
| ->setDescription( | ->setDescription( | ||||
| pht('Actions performed to verify the behavior of the change.')) | pht('Actions performed to verify the behavior of the change.')) | ||||
| ->setConduitDescription(pht('Update the revision test plan.')) | ->setConduitDescription(pht('Update the revision test plan.')) | ||||
| ->setConduitTypeDescription(pht('New test plan.')) | ->setConduitTypeDescription(pht('New test plan.')) | ||||
| ->setValue($object->getTestPlan()); | ->setValue($object->getTestPlan()); | ||||
| } | } | ||||
| $fields[] = id(new PhabricatorDatasourceEditField()) | $fields[] = id(new PhabricatorDatasourceEditField()) | ||||
| ->setKey('reviewerPHIDs') | ->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) | ||||
| ->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.')) | ||||
| Show All 26 Lines | |||||