mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Author Can Close Audit Option
Summary: Fixes T2339 Test Plan: Close Audit button does not appear if audit.can-author-close-audit option is disabled Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2339 Differential Revision: https://secure.phabricator.com/D4525
This commit is contained in:
parent
ed2c050bd5
commit
b801ca8e6f
4 changed files with 22 additions and 2 deletions
|
@ -1338,4 +1338,9 @@ return array(
|
||||||
// the $PATH environment variable, for when these binaries are in non-standard
|
// the $PATH environment variable, for when these binaries are in non-standard
|
||||||
// locations.
|
// locations.
|
||||||
'environment.append-paths' => array(),
|
'environment.append-paths' => array(),
|
||||||
|
|
||||||
|
// -- Audit ---------------------------------------------------------- //
|
||||||
|
|
||||||
|
// Controls whether or not task creator can Close Audits
|
||||||
|
'audit.can-author-close-audit' => false,
|
||||||
);
|
);
|
||||||
|
|
|
@ -109,6 +109,10 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
|
||||||
$actor_is_author = ($actor->getPHID() == $commit->getAuthorPHID());
|
$actor_is_author = ($actor->getPHID() == $commit->getAuthorPHID());
|
||||||
|
|
||||||
if ($action == PhabricatorAuditActionConstants::CLOSE) {
|
if ($action == PhabricatorAuditActionConstants::CLOSE) {
|
||||||
|
if (!PhabricatorEnv::getEnvConfig('audit.can-author-close-audit')) {
|
||||||
|
throw new Exception('Cannot Close Audit without enabling'.
|
||||||
|
'audit.can-author-close-audit');
|
||||||
|
}
|
||||||
// "Close" means wipe out all the concerns.
|
// "Close" means wipe out all the concerns.
|
||||||
$concerned_status = PhabricatorAuditStatusConstants::CONCERNED;
|
$concerned_status = PhabricatorAuditStatusConstants::CONCERNED;
|
||||||
foreach ($requests as $request) {
|
foreach ($requests as $request) {
|
||||||
|
|
|
@ -55,6 +55,16 @@ final class PhabricatorDiffusionConfigOptions
|
||||||
->setDescription(pht('Hard byte limit on including patches in email.')),
|
->setDescription(pht('Hard byte limit on including patches in email.')),
|
||||||
$this->newOption('metamta.diffusion.time-limit', 'int', 60)
|
$this->newOption('metamta.diffusion.time-limit', 'int', 60)
|
||||||
->setDescription(pht('Hard time limit on generating patches.')),
|
->setDescription(pht('Hard time limit on generating patches.')),
|
||||||
|
$this->newOption(
|
||||||
|
'audit.can-author-close-audit',
|
||||||
|
'bool',
|
||||||
|
false)
|
||||||
|
->setBoolOptions(
|
||||||
|
array(
|
||||||
|
pht("Enable Closing Audits"),
|
||||||
|
pht("Disable Closing Audits"),
|
||||||
|
))
|
||||||
|
->setDescription(pht('Controls whether Author can Close Audits.')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -748,8 +748,9 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
|
|
||||||
$status_concern = PhabricatorAuditCommitStatusConstants::CONCERN_RAISED;
|
$status_concern = PhabricatorAuditCommitStatusConstants::CONCERN_RAISED;
|
||||||
$concern_raised = ($commit->getAuditStatus() == $status_concern);
|
$concern_raised = ($commit->getAuditStatus() == $status_concern);
|
||||||
|
$can_close_option = PhabricatorEnv::getEnvConfig(
|
||||||
if ($user_is_author && $concern_raised) {
|
'audit.can-author-close-audit');
|
||||||
|
if ($can_close_option && $user_is_author && $concern_raised) {
|
||||||
$actions[PhabricatorAuditActionConstants::CLOSE] = true;
|
$actions[PhabricatorAuditActionConstants::CLOSE] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue