1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 23:02:41 +01:00

Warn user about specifying reviewers that are away

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
This commit is contained in:
vrana 2012-05-17 19:27:24 -07:00
parent 1369168161
commit a5c6f32a06

View file

@ -1538,6 +1538,24 @@ EOTEXT
} else if (in_array($this->getUserPHID(), $reviewers)) { } else if (in_array($this->getUserPHID(), $reviewers)) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
"You can not be a reviewer for your own revision."); "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.');
}
}
} }
} }