From 304a2c73aa5d0c6a39229c23e431241d7d76723d Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 30 Jun 2011 13:51:24 -0700 Subject: [PATCH] Prohibit creation of command-line revisions with yourself as the reviewer Summary: We do this check on the web interface but not from the CLI. Also clean up some GUID/PHID stuff (eventually all GUID references should be replaced with PHID, although they mean the same thing). Test Plan: Tried to create a revision with myself on the reviewer line, got called out. Reviewed By: jungejason Reviewers: moskov, jungejason, tuomaspelkonen, aran CC: aran, jungejason Differential Revision: 564 --- src/workflow/diff/ArcanistDiffWorkflow.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/workflow/diff/ArcanistDiffWorkflow.php b/src/workflow/diff/ArcanistDiffWorkflow.php index e80fb0d5..0f376827 100644 --- a/src/workflow/diff/ArcanistDiffWorkflow.php +++ b/src/workflow/diff/ArcanistDiffWorkflow.php @@ -886,7 +886,7 @@ EOTEXT // TODO: Move this all behind Conduit. if (!$message->getRevisionID()) { - if ($message->getFieldValue('reviewedByGUIDs')) { + if ($message->getFieldValue('reviewedByPHIDs')) { $problems[$key][] = new ArcanistUsageException( "When creating or updating a revision, use the 'Reviewers:' ". "field to specify reviewers, not 'Reviewed By:'. After the ". @@ -949,12 +949,15 @@ EOTEXT } if ($blessed) { - if (!$blessed->getFieldValue('reviewerGUIDs') && - !$blessed->getFieldValue('reviewerPHIDs')) { + $reviewers = $blessed->getFieldValue('reviewerPHIDs'); + if (!$reviewers) { $message = "You have not specified any reviewers. Continue anyway?"; if (!phutil_console_confirm($message)) { throw new ArcanistUsageException('Specify reviewers and retry.'); } + } else if (in_array($this->getUserGUID(), $reviewers)) { + throw new ArcanistUsageException( + "You can not be a reviewer for your own revision."); } }