Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / config / controller / issue / PhabricatorConfigIgnoreController.php
blobcfe5a225eff858087333e371c37480fb5e27e685
1 <?php
3 final class PhabricatorConfigIgnoreController
4 extends PhabricatorConfigController {
6 public function handleRequest(AphrontRequest $request) {
7 $viewer = $request->getViewer();
8 $issue = $request->getURIData('key');
9 $verb = $request->getURIData('verb');
11 $issue_uri = $this->getApplicationURI('issue/'.$issue.'/');
13 if ($request->isDialogFormPost()) {
14 $this->manageApplication($issue);
15 return id(new AphrontRedirectResponse())->setURI($issue_uri);
18 if ($verb == 'ignore') {
19 $title = pht('Really ignore this setup issue?');
20 $submit_title = pht('Ignore');
21 $body = pht(
22 "You can ignore an issue if you don't want to fix it, or plan to ".
23 "fix it later. Ignored issues won't appear on every page but will ".
24 "still be shown in the list of open issues.");
25 } else if ($verb == 'unignore') {
26 $title = pht('Unignore this setup issue?');
27 $submit_title = pht('Unignore');
28 $body = pht(
29 'This issue will no longer be suppressed, and will return to its '.
30 'rightful place as a global setup warning.');
31 } else {
32 throw new Exception(pht('Unrecognized verb: %s', $verb));
35 return $this->newDialog()
36 ->setTitle($title)
37 ->appendChild($body)
38 ->addSubmitButton($submit_title)
39 ->addCancelButton($issue_uri);
43 public function manageApplication($issue) {
44 $key = 'config.ignore-issues';
45 $config_entry = PhabricatorConfigEntry::loadConfigEntry($key);
46 $list = $config_entry->getValue();
48 if (isset($list[$issue])) {
49 unset($list[$issue]);
50 } else {
51 $list[$issue] = true;
54 PhabricatorConfigEditor::storeNewValue(
55 $this->getRequest()->getUser(),
56 $config_entry,
57 $list,
58 PhabricatorContentSource::newFromRequest($this->getRequest()));