@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.

Simplify "Test Plan" custom field

Summary: Ref T11114. This leaves mail integration and UI integration, but strips all the editing (now handled by EditEngine) and commit message stuff (now handled by CommitMessageField).

Test Plan: Viewed and edited test plans and test plan transactions.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114

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

+2 -110
-110
src/applications/differential/customfield/DifferentialTestPlanField.php
··· 7 7 return 'differential:test-plan'; 8 8 } 9 9 10 - public function getFieldKeyForConduit() { 11 - return 'testPlan'; 12 - } 13 - 14 10 public function getFieldName() { 15 11 return pht('Test Plan'); 16 12 } ··· 25 21 return null; 26 22 } 27 23 return $revision->getTestPlan(); 28 - } 29 - 30 - protected function writeValueToRevision( 31 - DifferentialRevision $revision, 32 - $value) { 33 - $revision->setTestPlan($value); 34 - } 35 - 36 - protected function isCoreFieldRequired() { 37 - return PhabricatorEnv::getEnvConfig('differential.require-test-plan-field'); 38 24 } 39 25 40 26 public function canDisableField() { 41 27 return true; 42 28 } 43 29 44 - protected function getCoreFieldRequiredErrorString() { 45 - return pht( 46 - 'You must provide a test plan. Describe the actions you performed '. 47 - 'to verify the behavior of this change.'); 48 - } 49 - 50 - public function readValueFromRequest(AphrontRequest $request) { 51 - $this->setValue($request->getStr($this->getFieldKey())); 52 - } 53 - 54 - public function renderEditControl(array $handles) { 55 - return id(new PhabricatorRemarkupControl()) 56 - ->setUser($this->getViewer()) 57 - ->setName($this->getFieldKey()) 58 - ->setValue($this->getValue()) 59 - ->setError($this->getFieldError()) 60 - ->setLabel($this->getFieldName()); 61 - } 62 - 63 - public function getApplicationTransactionTitle( 64 - PhabricatorApplicationTransaction $xaction) { 65 - $author_phid = $xaction->getAuthorPHID(); 66 - $old = $xaction->getOldValue(); 67 - $new = $xaction->getNewValue(); 68 - 69 - return pht( 70 - '%s updated the test plan for this revision.', 71 - $xaction->renderHandleLink($author_phid)); 72 - } 73 - 74 - public function getApplicationTransactionTitleForFeed( 75 - PhabricatorApplicationTransaction $xaction) { 76 - 77 - $object_phid = $xaction->getObjectPHID(); 78 - $author_phid = $xaction->getAuthorPHID(); 79 - $old = $xaction->getOldValue(); 80 - $new = $xaction->getNewValue(); 81 - 82 - return pht( 83 - '%s updated the test plan for %s.', 84 - $xaction->renderHandleLink($author_phid), 85 - $xaction->renderHandleLink($object_phid)); 86 - } 87 - 88 - public function getApplicationTransactionHasChangeDetails( 89 - PhabricatorApplicationTransaction $xaction) { 90 - return true; 91 - } 92 - 93 - public function getApplicationTransactionChangeDetails( 94 - PhabricatorApplicationTransaction $xaction, 95 - PhabricatorUser $viewer) { 96 - return $xaction->renderTextCorpusChangeDetails( 97 - $viewer, 98 - $xaction->getOldValue(), 99 - $xaction->getNewValue()); 100 - } 101 - 102 - public function shouldHideInApplicationTransactions( 103 - PhabricatorApplicationTransaction $xaction) { 104 - return ($xaction->getOldValue() === null); 105 - } 106 - 107 30 public function shouldAppearInGlobalSearch() { 108 31 return true; 109 32 } ··· 137 60 } 138 61 139 62 return new PHUIRemarkupView($this->getViewer(), $this->getValue()); 140 - } 141 - 142 - public function getApplicationTransactionRemarkupBlocks( 143 - PhabricatorApplicationTransaction $xaction) { 144 - return array($xaction->getNewValue()); 145 - } 146 - 147 - public function shouldAppearInCommitMessage() { 148 - return true; 149 - } 150 - 151 - public function shouldAppearInCommitMessageTemplate() { 152 - return true; 153 - } 154 - 155 - public function shouldOverwriteWhenCommitMessageIsEdited() { 156 - return true; 157 - } 158 - 159 - public function getCommitMessageLabels() { 160 - return array( 161 - 'Test Plan', 162 - 'Testplan', 163 - 'Tested', 164 - 'Tests', 165 - ); 166 - } 167 - 168 - public function validateCommitMessageValue($value) { 169 - if (!strlen($value) && $this->isCoreFieldRequired()) { 170 - throw new DifferentialFieldValidationException( 171 - $this->getCoreFieldRequiredErrorString()); 172 - } 173 63 } 174 64 175 65 public function shouldAppearInTransactionMail() {
+2
src/applications/differential/storage/DifferentialTransaction.php
··· 32 32 switch ($this->getMetadataValue('customfield:key')) { 33 33 case 'differential:title': 34 34 return new DifferentialRevisionTitleTransaction(); 35 + case 'differential:test-plan': 36 + return new DifferentialRevisionTestPlanTransaction(); 35 37 } 36 38 } 37 39