2013-03-06 23:14:09 +01:00
|
|
|
<?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();
|
2014-09-05 21:26:58 +02:00
|
|
|
$issue_uri = $this->getApplicationURI('issue/'.$this->issue.'/');
|
2013-03-06 23:14:09 +01:00
|
|
|
|
|
|
|
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');
|
2013-07-12 20:20:24 +02:00
|
|
|
$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.");
|
2013-03-06 23:14:09 +01:00
|
|
|
} else if ($this->verb == 'unignore') {
|
2013-07-12 20:20:24 +02:00
|
|
|
$title = pht('Unignore this setup issue?');
|
2013-03-06 23:14:09 +01:00
|
|
|
$submit_title = pht('Unignore');
|
2013-07-12 20:20:24 +02:00
|
|
|
$body = pht(
|
2014-06-09 20:36:49 +02:00
|
|
|
'This issue will no longer be suppressed, and will return to its '.
|
|
|
|
'rightful place as a global setup warning.');
|
2013-03-06 23:14:09 +01:00
|
|
|
} else {
|
2014-06-10 01:03:58 +02:00
|
|
|
throw new Exception('Unrecognized verb: '.$this->verb);
|
2013-03-06 23:14:09 +01:00
|
|
|
}
|
2013-07-12 20:20:24 +02:00
|
|
|
|
|
|
|
$dialog = id(new AphrontDialogView())
|
|
|
|
->setUser($request->getUser())
|
|
|
|
->setTitle($title)
|
|
|
|
->appendChild($body)
|
|
|
|
->addSubmitButton($submit_title)
|
|
|
|
->addCancelButton($issue_uri);
|
2013-03-06 23:14:09 +01:00
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|