From b7b783d77125f1ee4a7bd23323d892ac7d953392 Mon Sep 17 00:00:00 2001 From: Dereckson Date: Fri, 12 Oct 2012 07:40:08 -0700 Subject: [PATCH] Allow to push revisions to review by himself to Differential (bug T1879, change 1/2, Differential part) Summary: Checks if the revision author is in reviewers only if differential.allow-self-accept is false. Test Plan: Tested locally pushing revisions with "arc diff" to a Phabricator server with differential.allow-self-accept at true or false with myself or not as reviewer. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1879 Differential Revision: https://secure.phabricator.com/D3673 --- .../DifferentialReviewersFieldSpecification.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php b/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php index 280fb5c8a8..47783a9d43 100644 --- a/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php @@ -61,7 +61,10 @@ final class DifferentialReviewersFieldSpecification } public function validateField() { - if (in_array($this->getUser()->getPHID(), $this->reviewers)) { + $allow_self_accept = PhabricatorEnv::getEnvConfig( + 'differential.allow-self-accept', false); + if (!$allow_self_accept + && in_array($this->getUser()->getPHID(), $this->reviewers)) { $this->error = 'Invalid'; throw new DifferentialFieldValidationException( "You may not review your own revision!");