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

Remove some remnants of the old ways commit mesage fields worked from Differential

Summary:
Ref T11114. Ref T12085. I missed a few pieces of cleanup when moving all this stuff over.

In particular, load all fields which use Custom Field storage before doing commit-message-related stuff, instead of just the ones that claim they appear on commit messages.

Test Plan: Edited revisions and made API calls without apparent issues. See followup on T12085, shortly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12085, T11114

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

+4 -197
+3 -1
src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php
··· 142 142 private function loadCustomFieldStorage( 143 143 PhabricatorUser $viewer, 144 144 DifferentialRevision $revision) { 145 + 145 146 $custom_field_list = PhabricatorCustomField::getObjectFields( 146 147 $revision, 147 - DifferentialCustomField::ROLE_COMMITMESSAGE); 148 + PhabricatorCustomField::ROLE_STORAGE); 149 + 148 150 $custom_field_list 149 151 ->setViewer($viewer) 150 152 ->readFieldsFromStorage($revision);
-4
src/applications/differential/customfield/DifferentialAuditorsField.php
··· 36 36 return true; 37 37 } 38 38 39 - public function shouldAppearInCommitMessage() { 40 - return true; 41 - } 42 - 43 39 public function shouldAppearInConduitTransactions() { 44 40 return true; 45 41 }
-4
src/applications/differential/customfield/DifferentialBlameRevisionField.php
··· 91 91 $xaction->renderHandleLink($object_phid)); 92 92 } 93 93 94 - public function shouldAppearInCommitMessage() { 95 - return true; 96 - } 97 - 98 94 public function shouldAppearInConduitDictionary() { 99 95 return true; 100 96 }
-9
src/applications/differential/customfield/DifferentialCoreCustomField.php
··· 156 156 return $this->value; 157 157 } 158 158 159 - public function readValueFromCommitMessage($value) { 160 - $this->setValue($value); 161 - return $this; 162 - } 163 - 164 - public function renderCommitMessageValue(array $handles) { 165 - return $this->getValue(); 166 - } 167 - 168 159 public function getConduitDictionaryValue() { 169 160 return $this->getValue(); 170 161 }
-137
src/applications/differential/customfield/DifferentialCustomField.php
··· 7 7 abstract class DifferentialCustomField 8 8 extends PhabricatorCustomField { 9 9 10 - const ROLE_COMMITMESSAGE = 'differential:commitmessage'; 11 - const ROLE_COMMITMESSAGEEDIT = 'differential:commitmessageedit'; 12 - 13 10 /** 14 11 * TODO: It would be nice to remove this, but a lot of different code is 15 12 * bound together by it. Until everything is modernized, retaining the old ··· 23 20 // TODO: As above. 24 21 public function getModernFieldKey() { 25 22 return $this->getFieldKeyForConduit(); 26 - } 27 - 28 - public function shouldEnableForRole($role) { 29 - switch ($role) { 30 - case self::ROLE_COMMITMESSAGE: 31 - return $this->shouldAppearInCommitMessage(); 32 - case self::ROLE_COMMITMESSAGEEDIT: 33 - return $this->shouldAppearInCommitMessage() && 34 - $this->shouldAllowEditInCommitMessage(); 35 - } 36 - 37 - return parent::shouldEnableForRole($role); 38 23 } 39 24 40 25 protected function parseObjectList( ··· 100 85 /** 101 86 * @task commitmessage 102 87 */ 103 - public function shouldAppearInCommitMessage() { 104 - if ($this->getProxy()) { 105 - return $this->getProxy()->shouldAppearInCommitMessage(); 106 - } 107 - return false; 108 - } 109 - 110 - 111 - /** 112 - * @task commitmessage 113 - */ 114 - public function shouldAppearInCommitMessageTemplate() { 115 - if ($this->getProxy()) { 116 - return $this->getProxy()->shouldAppearInCommitMessageTemplate(); 117 - } 118 - return false; 119 - } 120 - 121 - 122 - /** 123 - * @task commitmessage 124 - */ 125 - public function shouldAllowEditInCommitMessage() { 126 - if ($this->getProxy()) { 127 - return $this->getProxy()->shouldAllowEditInCommitMessage(); 128 - } 129 - return true; 130 - } 131 - 132 - 133 - /** 134 - * @task commitmessage 135 - */ 136 88 public function getProTips() { 137 89 if ($this->getProxy()) { 138 90 return $this->getProxy()->getProTips(); 139 91 } 140 92 return array(); 141 - } 142 - 143 - 144 - /** 145 - * @task commitmessage 146 - */ 147 - public function getCommitMessageLabels() { 148 - if ($this->getProxy()) { 149 - return $this->getProxy()->getCommitMessageLabels(); 150 - } 151 - return array($this->renderCommitMessageLabel()); 152 - } 153 - 154 - 155 - /** 156 - * @task commitmessage 157 - */ 158 - public function parseValueFromCommitMessage($value) { 159 - if ($this->getProxy()) { 160 - return $this->getProxy()->parseValueFromCommitMessage($value); 161 - } 162 - return $value; 163 - } 164 - 165 - 166 - /** 167 - * @task commitmessage 168 - */ 169 - public function readValueFromCommitMessage($value) { 170 - if ($this->getProxy()) { 171 - $this->getProxy()->readValueFromCommitMessage($value); 172 - return $this; 173 - } 174 - return $this; 175 - } 176 - 177 - 178 - /** 179 - * @task commitmessage 180 - */ 181 - public function shouldOverwriteWhenCommitMessageIsEdited() { 182 - if ($this->getProxy()) { 183 - return $this->getProxy()->shouldOverwriteWhenCommitMessageIsEdited(); 184 - } 185 - return false; 186 - } 187 - 188 - 189 - /** 190 - * @task commitmessage 191 - */ 192 - public function getRequiredHandlePHIDsForCommitMessage() { 193 - if ($this->getProxy()) { 194 - return $this->getProxy()->getRequiredHandlePHIDsForCommitMessage(); 195 - } 196 - return array(); 197 - } 198 - 199 - 200 - /** 201 - * @task commitmessage 202 - */ 203 - public function renderCommitMessageLabel() { 204 - if ($this->getProxy()) { 205 - return $this->getProxy()->renderCommitMessageLabel(); 206 - } 207 - return $this->getFieldName(); 208 - } 209 - 210 - 211 - /** 212 - * @task commitmessage 213 - */ 214 - public function renderCommitMessageValue(array $handles) { 215 - if ($this->getProxy()) { 216 - return $this->getProxy()->renderCommitMessageValue($handles); 217 - } 218 - throw new PhabricatorCustomFieldImplementationIncompleteException($this); 219 - } 220 - 221 - 222 - /** 223 - * @task commitmessage 224 - */ 225 - public function validateCommitMessageValue($value) { 226 - if ($this->getProxy()) { 227 - return $this->getProxy()->validateCommitMessageValue($value); 228 - } 229 - return; 230 93 } 231 94 232 95
-33
src/applications/differential/customfield/DifferentialJIRAIssuesField.php
··· 270 270 $editor->save(); 271 271 } 272 272 273 - public function shouldAppearInCommitMessage() { 274 - return true; 275 - } 276 - 277 - public function shouldAppearInCommitMessageTemplate() { 278 - return true; 279 - } 280 - 281 - public function getCommitMessageLabels() { 282 - return array( 283 - 'JIRA', 284 - 'JIRA Issues', 285 - 'JIRA Issue', 286 - ); 287 - } 288 - 289 - public function parseValueFromCommitMessage($value) { 290 - return preg_split('/[\s,]+/', $value, $limit = -1, PREG_SPLIT_NO_EMPTY); 291 - } 292 - 293 - public function readValueFromCommitMessage($value) { 294 - $this->setValue($value); 295 - return $this; 296 - } 297 - 298 - public function renderCommitMessageValue(array $handles) { 299 - $value = $this->getValue(); 300 - if (!$value) { 301 - return null; 302 - } 303 - return implode(', ', $value); 304 - } 305 - 306 273 public function shouldAppearInConduitDictionary() { 307 274 return true; 308 275 }
-8
src/applications/differential/customfield/DifferentialRevertPlanField.php
··· 130 130 return array($xaction->getNewValue()); 131 131 } 132 132 133 - public function shouldAppearInCommitMessage() { 134 - return true; 135 - } 136 - 137 - public function renderCommitMessageValue(array $handles) { 138 - return $this->getValue(); 139 - } 140 - 141 133 public function shouldAppearInConduitDictionary() { 142 134 return true; 143 135 }
+1 -1
src/applications/differential/field/DifferentialCommitMessageCustomField.php
··· 45 45 protected function getCustomFieldOrder($key) { 46 46 $field_list = PhabricatorCustomField::getObjectFields( 47 47 new DifferentialRevision(), 48 - DifferentialCustomField::ROLE_COMMITMESSAGE); 48 + PhabricatorCustomField::ROLE_DEFAULT); 49 49 50 50 $fields = $field_list->getFields(); 51 51