@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 Auditors custom field in Differential

Summary: Ref T11114. This field just stores the value of "Auditors" so you can trigger auditors explicitly later on if you want.

Test Plan: Created and edited revisions with "Auditors".

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114

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

+44 -24
+9 -22
src/applications/differential/customfield/DifferentialAuditorsField.php
··· 16 16 } 17 17 18 18 public function getValueForStorage() { 19 - return json_encode($this->getValue()); 19 + return phutil_json_encode($this->getValue()); 20 20 } 21 21 22 22 public function setValueFromStorage($value) { ··· 28 28 return $this; 29 29 } 30 30 31 - public function shouldAppearInCommitMessage() { 32 - return true; 33 - } 34 - 35 - public function shouldAllowEditInCommitMessage() { 36 - return true; 37 - } 38 - 39 31 public function canDisableField() { 40 32 return false; 41 33 } 42 34 43 - public function getRequiredHandlePHIDsForCommitMessage() { 44 - return nonempty($this->getValue(), array()); 35 + public function shouldAppearInEditEngine() { 36 + return true; 45 37 } 46 38 47 - public function parseCommitMessageValue($value) { 48 - return $this->parseObjectList( 49 - $value, 50 - array( 51 - PhabricatorPeopleUserPHIDType::TYPECONST, 52 - PhabricatorProjectProjectPHIDType::TYPECONST, 53 - )); 54 - } 55 - 56 - public function renderCommitMessageValue(array $handles) { 57 - return $this->renderObjectList($handles); 39 + public function shouldAppearInCommitMessage() { 40 + return true; 58 41 } 59 42 60 43 public function shouldAppearInConduitTransactions() { ··· 63 46 64 47 protected function newConduitEditParameterType() { 65 48 return new ConduitPHIDListParameterType(); 49 + } 50 + 51 + public function shouldAppearInApplicationTransactions() { 52 + return true; 66 53 } 67 54 68 55 }
+8
src/applications/differential/field/DifferentialAuditorsCommitMessageField.php
··· 22 22 return 'phabricator:auditors'; 23 23 } 24 24 25 + public function isFieldEditable() { 26 + return true; 27 + } 28 + 29 + public function isTemplateField() { 30 + return false; 31 + } 32 + 25 33 public function readFieldValueFromConduit($value) { 26 34 return $this->readStringListFieldValueFromConduit($value); 27 35 }
+1 -1
src/applications/differential/field/DifferentialCommitMessageField.php
··· 182 182 protected function isCustomFieldEnabled($key) { 183 183 $field_list = PhabricatorCustomField::getObjectFields( 184 184 new DifferentialRevision(), 185 - PhabricatorCustomField::ROLE_VIEW); 185 + DifferentialCustomField::ROLE_COMMITMESSAGE); 186 186 187 187 $fields = $field_list->getFields(); 188 188 return isset($fields[$key]);
+4
src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php
··· 37 37 } 38 38 39 39 protected function buildControl() { 40 + if ($this->getIsConduitOnly()) { 41 + return null; 42 + } 43 + 40 44 $field = $this->getCustomField(); 41 45 $clone = clone $field; 42 46
+1 -1
src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php
··· 31 31 32 32 $field_list = PhabricatorCustomField::getObjectFields( 33 33 $object, 34 - PhabricatorCustomField::ROLE_EDIT); 34 + PhabricatorCustomField::ROLE_EDITENGINE); 35 35 36 36 $field_list->setViewer($viewer); 37 37
+21
src/infrastructure/customfield/field/PhabricatorCustomField.php
··· 33 33 const ROLE_GLOBALSEARCH = 'GlobalSearch'; 34 34 const ROLE_CONDUIT = 'conduit'; 35 35 const ROLE_HERALD = 'herald'; 36 + const ROLE_EDITENGINE = 'EditEngine'; 36 37 37 38 38 39 /* -( Building Applications with Custom Fields )--------------------------- */ ··· 292 293 return $this->shouldAppearInTransactionMail(); 293 294 case self::ROLE_HERALD: 294 295 return $this->shouldAppearInHerald(); 296 + case self::ROLE_EDITENGINE: 297 + return $this->shouldAppearInEditView() || 298 + $this->shouldAppearInEditEngine(); 295 299 case self::ROLE_DEFAULT: 296 300 return true; 297 301 default: ··· 1120 1124 return $this->proxy->newStandardEditField(); 1121 1125 } 1122 1126 1127 + if (!$this->shouldAppearInEditView()) { 1128 + $conduit_only = true; 1129 + } else { 1130 + $conduit_only = false; 1131 + } 1132 + 1123 1133 return $this->newEditField() 1124 1134 ->setKey($this->getFieldKey()) 1125 1135 ->setEditTypeKey($this->getModernFieldKey()) 1126 1136 ->setLabel($this->getFieldName()) 1127 1137 ->setDescription($this->getFieldDescription()) 1128 1138 ->setTransactionType($this->getApplicationTransactionType()) 1139 + ->setIsConduitOnly($conduit_only) 1129 1140 ->setValue($this->getNewValueForApplicationTransactions()); 1130 1141 } 1131 1142 ··· 1142 1153 public function shouldAppearInEditView() { 1143 1154 if ($this->proxy) { 1144 1155 return $this->proxy->shouldAppearInEditView(); 1156 + } 1157 + return false; 1158 + } 1159 + 1160 + /** 1161 + * @task edit 1162 + */ 1163 + public function shouldAppearInEditEngine() { 1164 + if ($this->proxy) { 1165 + return $this->proxy->shouldAppearInEditEngine(); 1145 1166 } 1146 1167 return false; 1147 1168 }