mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Differential - add a configuration option to allow any user to close a revision that has been accepted
Summary: this is useful for certain workflows, typically where the reviewer is a gatekeeper of sorts who does the acutal commit. Special thanks to D2900 which made this relatively brain-dead to code up. Test Plan: set to "true" in my local development environment and verified test user "xerxes" could close my stuff Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1732 Differential Revision: https://secure.phabricator.com/D3398
This commit is contained in:
parent
cdfc71ced5
commit
3aa54782a7
3 changed files with 15 additions and 3 deletions
|
@ -1019,6 +1019,13 @@ return array(
|
|||
// use of all of differential's features.
|
||||
'differential.allow-self-accept' => false,
|
||||
|
||||
// If you set this to true, any user can close any revision so long as it has
|
||||
// been accepted. This can be useful depending on your development model. For
|
||||
// example, github-style pull requests where the reviewer is often the
|
||||
// actual committer can benefit from turning this option to true. If false,
|
||||
// only the submitter can close a revision.
|
||||
'differential.always-allow-close' => false,
|
||||
|
||||
// Revisions newer than this number of days are marked as fresh in Action
|
||||
// Required and Revisions Waiting on You views. Only work days (not weekends
|
||||
// and holidays) are included. Set to 0 to disable this feature.
|
||||
|
|
|
@ -566,6 +566,8 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
|
||||
$allow_self_accept = PhabricatorEnv::getEnvConfig(
|
||||
'differential.allow-self-accept', false);
|
||||
$always_allow_close = PhabricatorEnv::getEnvConfig(
|
||||
'differential.always-allow-close', false);
|
||||
|
||||
if ($viewer_is_owner) {
|
||||
switch ($status) {
|
||||
|
@ -613,6 +615,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
}
|
||||
if ($status != ArcanistDifferentialRevisionStatus::CLOSED) {
|
||||
$actions[DifferentialAction::ACTION_CLAIM] = true;
|
||||
$actions[DifferentialAction::ACTION_CLOSE] = $always_allow_close;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,6 +119,8 @@ final class DifferentialCommentEditor {
|
|||
$actor_is_author = ($actor_phid == $revision->getAuthorPHID());
|
||||
$allow_self_accept = PhabricatorEnv::getEnvConfig(
|
||||
'differential.allow-self-accept', false);
|
||||
$always_allow_close = PhabricatorEnv::getEnvConfig(
|
||||
'differential.always-allow-close', false);
|
||||
$revision_status = $revision->getStatus();
|
||||
|
||||
$revision->loadRelationships();
|
||||
|
@ -349,7 +351,7 @@ final class DifferentialCommentEditor {
|
|||
// them as completely authoritative.
|
||||
|
||||
if (!$this->isDaemonWorkflow) {
|
||||
if (!$actor_is_author) {
|
||||
if (!$actor_is_author && !$always_allow_close) {
|
||||
throw new Exception(
|
||||
"You can not mark a revision you don't own as closed.");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue