1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-22 18:28:47 +02:00
phorge-phorge/src/applications/config/controller/PhabricatorConfigIgnoreController.php
epriestley 3958bf3677 Make it easier to ignore setup issues
Summary:
Ref T4331. Ref T5968. Users sometimes have trouble figuring out how to ignore issues. The option is a bit hard to spot, especially if you aren't familiar with interfaces yet.
Make it a button on the issue page itself instead.

Test Plan:
Normal issue:

{F199225}

Ignored issue:

{F199226}

Fatal issue:

{F199227}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T4331, T5968

Differential Revision: https://secure.phabricator.com/D10420
2014-09-05 12:26:58 -07:00

65 lines
1.9 KiB
PHP

<?php
final class PhabricatorConfigIgnoreController
extends PhabricatorApplicationsController {
private $verb;
private $issue;
public function willProcessRequest(array $data) {
$this->verb = $data['verb'];
$this->issue = $data['key'];
}
public function processRequest() {
$request = $this->getRequest();
$issue_uri = $this->getApplicationURI('issue/'.$this->issue.'/');
if ($request->isDialogFormPost()) {
$this->manageApplication();
return id(new AphrontRedirectResponse())->setURI($issue_uri);
}
if ($this->verb == 'ignore') {
$title = pht('Really ignore this setup issue?');
$submit_title = pht('Ignore');
$body = pht(
"You can ignore an issue if you don't want to fix it, or plan to ".
"fix it later. Ignored issues won't appear on every page but will ".
"still be shown in the list of open issues.");
} else if ($this->verb == 'unignore') {
$title = pht('Unignore this setup issue?');
$submit_title = pht('Unignore');
$body = pht(
'This issue will no longer be suppressed, and will return to its '.
'rightful place as a global setup warning.');
} else {
throw new Exception('Unrecognized verb: '.$this->verb);
}
$dialog = id(new AphrontDialogView())
->setUser($request->getUser())
->setTitle($title)
->appendChild($body)
->addSubmitButton($submit_title)
->addCancelButton($issue_uri);
return id(new AphrontDialogResponse())->setDialog($dialog);
}
public function manageApplication() {
$key = 'config.ignore-issues';
$config_entry = PhabricatorConfigEntry::loadConfigEntry($key);
$list = $config_entry->getValue();
if (isset($list[$this->issue])) {
unset($list[$this->issue]);
} else {
$list[$this->issue] = true;
}
PhabricatorConfigEditor::storeNewValue(
$config_entry, $list, $this->getRequest());
}
}