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

Button to ignore setup issues + refractoring

Summary: T2381

Test Plan:
Click on the ignore link in /config/issue/ and respond to the dialog box.

Also, test uninstalling and reinstalling an application in the web UI (to verify that refractoring didn't break anything).

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2381

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

authored by

Nick Pellegrino and committed by
epriestley
8ec987dd 457b91f6

+122 -41
+2
src/__phutil_library_map__.php
··· 791 791 'PhabricatorConfigEntryDAO' => 'applications/config/storage/PhabricatorConfigEntryDAO.php', 792 792 'PhabricatorConfigFileSource' => 'infrastructure/env/PhabricatorConfigFileSource.php', 793 793 'PhabricatorConfigGroupController' => 'applications/config/controller/PhabricatorConfigGroupController.php', 794 + 'PhabricatorConfigIgnoreController' => 'applications/config/controller/PhabricatorConfigIgnoreController.php', 794 795 'PhabricatorConfigIssueListController' => 'applications/config/controller/PhabricatorConfigIssueListController.php', 795 796 'PhabricatorConfigIssueViewController' => 'applications/config/controller/PhabricatorConfigIssueViewController.php', 796 797 'PhabricatorConfigJSON' => 'applications/config/json/PhabricatorConfigJSON.php', ··· 2305 2306 'PhabricatorConfigEntryDAO' => 'PhabricatorLiskDAO', 2306 2307 'PhabricatorConfigFileSource' => 'PhabricatorConfigProxySource', 2307 2308 'PhabricatorConfigGroupController' => 'PhabricatorConfigController', 2309 + 'PhabricatorConfigIgnoreController' => 'PhabricatorApplicationsController', 2308 2310 'PhabricatorConfigIssueListController' => 'PhabricatorConfigController', 2309 2311 'PhabricatorConfigIssueViewController' => 'PhabricatorConfigController', 2310 2312 'PhabricatorConfigListController' => 'PhabricatorConfigController',
+2
src/applications/config/application/PhabricatorApplicationConfig.php
··· 29 29 'all/' => 'PhabricatorConfigAllController', 30 30 'edit/(?P<key>[\w\.\-]+)/' => 'PhabricatorConfigEditController', 31 31 'group/(?P<key>[^/]+)/' => 'PhabricatorConfigGroupController', 32 + '(?P<verb>ignore|unignore)/(?P<key>[^/]+)/' 33 + => 'PhabricatorConfigIgnoreController', 32 34 'issue/' => array( 33 35 '' => 'PhabricatorConfigIssueListController', 34 36 '(?P<key>[^/]+)/' => 'PhabricatorConfigIssueViewController',
+57
src/applications/config/controller/PhabricatorConfigIgnoreController.php
··· 1 + <?php 2 + 3 + final class PhabricatorConfigIgnoreController 4 + extends PhabricatorApplicationsController { 5 + 6 + private $verb; 7 + private $issue; 8 + 9 + public function willProcessRequest(array $data) { 10 + $this->verb = $data['verb']; 11 + $this->issue = $data['key']; 12 + } 13 + 14 + public function processRequest() { 15 + $request = $this->getRequest(); 16 + $issue_uri = $this->getApplicationURI('issue'); 17 + 18 + if ($request->isDialogFormPost()) { 19 + $this->manageApplication(); 20 + return id(new AphrontRedirectResponse())->setURI($issue_uri); 21 + } 22 + 23 + // User just clicked the link, so show them the dialog. 24 + if ($this->verb == 'ignore') { 25 + $title = pht('Really ignore this setup issue?'); 26 + $submit_title = pht('Ignore'); 27 + } else if ($this->verb == 'unignore') { 28 + $title = pht('Really unignore this setup issue?'); 29 + $submit_title = pht('Unignore'); 30 + } else { 31 + throw new Exception('Unrecognized verb: ' . $this->verb); 32 + } 33 + $dialog = new AphrontDialogView(); 34 + $dialog->setTitle($title) 35 + ->setUser($request->getUser()) 36 + ->addSubmitButton($submit_title) 37 + ->addCancelButton($issue_uri); 38 + 39 + return id(new AphrontDialogResponse())->setDialog($dialog); 40 + } 41 + 42 + public function manageApplication() { 43 + $key = 'config.ignore-issues'; 44 + $config_entry = PhabricatorConfigEntry::loadConfigEntry($key); 45 + $list = $config_entry->getValue(); 46 + 47 + if (isset($list[$this->issue])) { 48 + unset($list[$this->issue]); 49 + } else { 50 + $list[$this->issue] = true; 51 + } 52 + 53 + PhabricatorConfigEditor::storeNewValue( 54 + $config_entry, $list, $this->getRequest()); 55 + } 56 + 57 + }
+12
src/applications/config/controller/PhabricatorConfigIssueListController.php
··· 60 60 ->addAttribute($issue->getSummary()); 61 61 if (!$issue->getIsIgnored()) { 62 62 $item->addIcon('warning', pht('Setup Warning')); 63 + $link = javelin_tag( 64 + 'a', 65 + array('href' => '/config/ignore/'.$issue->getIssueKey().'/', 66 + 'sigil' => 'workflow'), 67 + pht('Ignore')); 68 + $item->addAttribute($link); 63 69 $list->addItem($item); 64 70 } else { 65 71 $item->addIcon('none', pht('Ignored')); 72 + $link = javelin_tag( 73 + 'a', 74 + array('href' => '/config/unignore/'.$issue->getIssueKey().'/', 75 + 'sigil' => 'workflow'), 76 + pht('Unignore')); 77 + $item->addAttribute($link); 66 78 $ignored_items[] = $item; 67 79 } 68 80 }
+24
src/applications/config/editor/PhabricatorConfigEditor.php
··· 104 104 PhabricatorSetupCheck::deleteSetupCheckCache(); 105 105 } 106 106 107 + public static function storeNewValue( 108 + PhabricatorConfigEntry $config_entry, $value, AphrontRequest $request) { 109 + $xaction = id(new PhabricatorConfigTransaction()) 110 + ->setTransactionType(PhabricatorConfigTransaction::TYPE_EDIT) 111 + ->setNewValue( 112 + array( 113 + 'deleted' => false, 114 + 'value' => $value 115 + )); 116 + 117 + $editor = id(new PhabricatorConfigEditor()) 118 + ->setActor($request->getUser()) 119 + ->setContinueOnNoEffect(true) 120 + ->setContentSource( 121 + PhabricatorContentSource::newForSource( 122 + PhabricatorContentSource::SOURCE_WEB, 123 + array( 124 + 'ip' => $request->getRemoteAddr(), 125 + ))); 126 + 127 + 128 + $editor->applyTransactions($config_entry, array($xaction)); 129 + } 130 + 107 131 }
+16
src/applications/config/storage/PhabricatorConfigEntry.php
··· 23 23 PhabricatorPHIDConstants::PHID_TYPE_CONF); 24 24 } 25 25 26 + public static function loadConfigEntry($key) { 27 + $config_entry = id(new PhabricatorConfigEntry()) 28 + ->loadOneWhere( 29 + 'configKey = %s AND namespace = %s', 30 + $key, 31 + 'default'); 32 + 33 + if (!$config_entry) { 34 + $config_entry = id(new PhabricatorConfigEntry()) 35 + ->setConfigKey($key) 36 + ->setNamespace('default'); 37 + } 38 + 39 + return $config_entry; 40 + } 41 + 26 42 }
+9 -41
src/applications/meta/controller/PhabricatorApplicationUninstallController.php
··· 61 61 62 62 public function manageApplication() { 63 63 $key = 'phabricator.uninstalled-applications'; 64 + $config_entry = PhabricatorConfigEntry::loadConfigEntry($key); 65 + $list = $config_entry->getValue(); 66 + $uninstalled = PhabricatorEnv::getEnvConfig($key); 64 67 65 - $config_entry = id(new PhabricatorConfigEntry()) 66 - ->loadOneWhere( 67 - 'configKey = %s AND namespace = %s', 68 - $key, 69 - 'default'); 70 - 71 - if (!$config_entry) { 72 - $config_entry = id(new PhabricatorConfigEntry()) 73 - ->setConfigKey($key) 74 - ->setNamespace('default'); 75 - } 76 - 77 - $list = $config_entry->getValue(); 78 - 79 - $uninstalled = PhabricatorEnv::getEnvConfig($key); 80 - 81 - if ($uninstalled[$this->application]) { 82 - unset($list[$this->application]); 83 - } else { 68 + if ($uninstalled[$this->application]) { 69 + unset($list[$this->application]); 70 + } else { 84 71 $list[$this->application] = true; 85 - } 72 + } 86 73 87 - $xaction = id(new PhabricatorConfigTransaction()) 88 - ->setTransactionType(PhabricatorConfigTransaction::TYPE_EDIT) 89 - ->setNewValue( 90 - array( 91 - 'deleted' => false, 92 - 'value' => $list 93 - )); 94 - 95 - $editor = id(new PhabricatorConfigEditor()) 96 - ->setActor($this->getRequest()->getUser()) 97 - ->setContinueOnNoEffect(true) 98 - ->setContentSource( 99 - PhabricatorContentSource::newForSource( 100 - PhabricatorContentSource::SOURCE_WEB, 101 - array( 102 - 'ip' => $this->getRequest()->getRemoteAddr(), 103 - ))); 104 - 105 - 106 - $editor->applyTransactions($config_entry, array($xaction)); 107 - 74 + PhabricatorConfigEditor::storeNewValue( 75 + $config_entry, $list, $this->getRequest()); 108 76 } 109 77 110 78 }