mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-21 22:32:41 +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:
parent
5ebfa50db3
commit
304a2c73aa
1 changed files with 6 additions and 3 deletions
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue