Skip to content

Commit

Permalink
Warn user about specifying reviewers that are away
Browse files Browse the repository at this point in the history
Summary:
There are different options how to implement this:
We can also generate the warning in `validateField()` and handle it in all callsites.
This is sufficient for me and simple enough.

Test Plan: `arc diff` revision with reviewer away/not away.

Reviewers: btrahan, jungejason

Reviewed By: jungejason

CC: epriestley, aran

Differential Revision: https://secure.phabricator.com/D2493
  • Loading branch information
vrana committed May 18, 2012
1 parent 1369168 commit a5c6f32
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/workflow/diff/ArcanistDiffWorkflow.php
Expand Up @@ -1538,6 +1538,24 @@ private function validateCommitMessage(
} else if (in_array($this->getUserPHID(), $reviewers)) {
throw new ArcanistUsageException(
"You can not be a reviewer for your own revision.");
} else {
$statuses = $this->getConduit()->callMethodSynchronous(
'user.getcurrentstatus',
array(
'userPHIDs' => $reviewers,
));
foreach ($statuses as $key => $status) {
if ($status['status'] != 'away') {
unset($statuses[$key]);
}
}
if (count($statuses) == count($reviewers)) {
$confirm = "All reviewers are away. Continue anyway?";
if (!phutil_console_confirm($confirm)) {
throw new ArcanistUsageException(
'Specify available reviewers and retry.');
}
}
}
}

Expand Down

0 comments on commit a5c6f32

Please sign in to comment.