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

Give "Autoclose Only" repository detail proper getters/setters

Summary:
Ref T13222. See D19829. We're inconsistent about using `getDetail()/setDetail()` to do some ad-hoc reads. Put this stuff in proper accessor methods.

Also a couple of text fixes from D19850.

Test Plan: Set, edited, and removed autoclose branches from a repository. Got sensible persistence and rendering behavior.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13222

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

+20 -10
+1 -2
src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
··· 215 215 $track_value = $object->getDetail('branch-filter', array()); 216 216 $track_value = array_keys($track_value); 217 217 218 - $autoclose_value = $object->getDetail('close-commits-filter', array()); 219 - $autoclose_value = array_keys($autoclose_value); 218 + $autoclose_value = $object->getAutocloseOnlyRules(); 220 219 221 220 $automation_instructions = pht( 222 221 "Configure **Repository Automation** to allow Phabricator to ".
+4 -2
src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
··· 24 24 $has_any = 25 25 $repository->getDetail('default-branch') || 26 26 $repository->getDetail('branch-filter') || 27 - $repository->getDetail('close-commits-filter'); 27 + $repository->getAutocloseOnlyRules(); 28 28 29 29 if ($has_any) { 30 30 return 'fa-code-fork'; ··· 83 83 phutil_tag('em', array(), pht('Track All Branches'))); 84 84 $view->addProperty(pht('Track Only'), $track_only); 85 85 86 + $autoclose_rules = $repository->getAutocloseOnlyRules(); 87 + $autoclose_rules = implode(', ', $autoclose_rules); 86 88 $autoclose_only = nonempty( 87 - $repository->getHumanReadableDetail('close-commits-filter', array()), 89 + $autoclose_rules, 88 90 phutil_tag('em', array(), pht('Autoclose On All Branches'))); 89 91 90 92 $autoclose_disabled = false;
+3 -3
src/applications/repository/management/PhabricatorRepositoryManagementThawWorkflow.php
··· 15 15 array( 16 16 array( 17 17 'name' => 'demote', 18 - 'param' => 'device/service', 18 + 'param' => 'device|service', 19 19 'help' => pht( 20 20 'Demote a device (or all devices in a service) discarding '. 21 - 'local changes. Clears stuck write locks and recovers from '. 22 - 'lost leaders.'), 21 + 'unsynchronized changes. Clears stuck write locks and recovers '. 22 + 'from lost leaders.'), 23 23 ), 24 24 array( 25 25 'name' => 'promote',
+10 -1
src/applications/repository/storage/PhabricatorRepository.php
··· 244 244 245 245 switch ($key) { 246 246 case 'branch-filter': 247 - case 'close-commits-filter': 248 247 $value = array_keys($value); 249 248 $value = implode(', ', $value); 250 249 break; ··· 1200 1199 } 1201 1200 1202 1201 return null; 1202 + } 1203 + 1204 + public function getAutocloseOnlyRules() { 1205 + return array_keys($this->getDetail('close-commits-filter', array())); 1206 + } 1207 + 1208 + public function setAutocloseOnlyRules(array $rules) { 1209 + $rules = array_fill_keys($rules, true); 1210 + $this->setDetail('close-commits-filter', $rules); 1211 + return $this; 1203 1212 } 1204 1213 1205 1214
+2 -2
src/applications/repository/xaction/PhabricatorRepositoryAutocloseOnlyTransaction.php
··· 6 6 const TRANSACTIONTYPE = 'repo:autoclose-only'; 7 7 8 8 public function generateOldValue($object) { 9 - return array_keys($object->getDetail('close-commits-filter', array())); 9 + return $object->getAutocloseOnlyRules(); 10 10 } 11 11 12 12 public function applyInternalEffects($object, $value) { 13 - $object->setDetail('close-commits-filter', array_fill_keys($value, true)); 13 + $object->setAutocloseOnlyRules($value); 14 14 } 15 15 16 16 public function getTitle() {