1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

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
This commit is contained in:
epriestley 2011-06-30 13:51:24 -07:00
parent 5ebfa50db3
commit 304a2c73aa

View file

@ -886,7 +886,7 @@ EOTEXT
// TODO: Move this all behind Conduit. // TODO: Move this all behind Conduit.
if (!$message->getRevisionID()) { if (!$message->getRevisionID()) {
if ($message->getFieldValue('reviewedByGUIDs')) { if ($message->getFieldValue('reviewedByPHIDs')) {
$problems[$key][] = new ArcanistUsageException( $problems[$key][] = new ArcanistUsageException(
"When creating or updating a revision, use the 'Reviewers:' ". "When creating or updating a revision, use the 'Reviewers:' ".
"field to specify reviewers, not 'Reviewed By:'. After the ". "field to specify reviewers, not 'Reviewed By:'. After the ".
@ -949,12 +949,15 @@ EOTEXT
} }
if ($blessed) { if ($blessed) {
if (!$blessed->getFieldValue('reviewerGUIDs') && $reviewers = $blessed->getFieldValue('reviewerPHIDs');
!$blessed->getFieldValue('reviewerPHIDs')) { if (!$reviewers) {
$message = "You have not specified any reviewers. Continue anyway?"; $message = "You have not specified any reviewers. Continue anyway?";
if (!phutil_console_confirm($message)) { if (!phutil_console_confirm($message)) {
throw new ArcanistUsageException('Specify reviewers and retry.'); 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.");
} }
} }