mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +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
|
||||
// locations.
|
||||
'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());
|
||||
|
||||
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.
|
||||
$concerned_status = PhabricatorAuditStatusConstants::CONCERNED;
|
||||
foreach ($requests as $request) {
|
||||
|
|
|
@ -55,6 +55,16 @@ final class PhabricatorDiffusionConfigOptions
|
|||
->setDescription(pht('Hard byte limit on including patches in email.')),
|
||||
$this->newOption('metamta.diffusion.time-limit', 'int', 60)
|
||||
->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;
|
||||
$concern_raised = ($commit->getAuditStatus() == $status_concern);
|
||||
|
||||
if ($user_is_author && $concern_raised) {
|
||||
$can_close_option = PhabricatorEnv::getEnvConfig(
|
||||
'audit.can-author-close-audit');
|
||||
if ($can_close_option && $user_is_author && $concern_raised) {
|
||||
$actions[PhabricatorAuditActionConstants::CLOSE] = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue