mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 08:42:40 +01:00
In "arc diff", warn when some reviewers are away even if not everyone is away
Summary: Ref T13249. See PHI810. We currently warn you when //all// reviewers are away, but not when only some reviewers are away. This makes some amount of sense under the "anyone can accept anything" rules we sort of recommend, but a lot of installs realistically have tons of owner/package rules now. Instead, if any reviewers are away, show the user exactly who is away and until when, then make sure they don't want to make any adjustments. (We can do a better job of this after the toolsets change when we can use the new APIs, but this is an easy fix for now.) Test Plan: Created a revision with multiple reviewers, either some or all of whom were away. Got appropriate output and prompt behavior. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13249 Differential Revision: https://secure.phabricator.com/D20172
This commit is contained in:
parent
7e61e43f65
commit
07a208d8fc
1 changed files with 47 additions and 8 deletions
|
@ -1820,17 +1820,56 @@ EOTEXT
|
||||||
$this->checkRevisionOwnership(head($result));
|
$this->checkRevisionOwnership(head($result));
|
||||||
break;
|
break;
|
||||||
case 'reviewers':
|
case 'reviewers':
|
||||||
$untils = array();
|
$away = array();
|
||||||
foreach ($result as $user) {
|
foreach ($result as $user) {
|
||||||
if (idx($user, 'currentStatus') == 'away') {
|
if (idx($user, 'currentStatus') != 'away') {
|
||||||
$untils[] = $user['currentStatusUntil'];
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$username = $user['userName'];
|
||||||
|
$real_name = $user['realName'];
|
||||||
|
|
||||||
|
if (strlen($real_name)) {
|
||||||
|
$name = pht('%s (%s)', $username, $real_name);
|
||||||
|
} else {
|
||||||
|
$name = pht('%s', $username);
|
||||||
}
|
}
|
||||||
if (count($untils) == count($reviewers)) {
|
|
||||||
$until = date('l, M j Y', min($untils));
|
$away[] = array(
|
||||||
$confirm = pht(
|
'name' => $name,
|
||||||
'All reviewers are away until %s. Continue anyway?',
|
'until' => $user['currentStatusUntil'],
|
||||||
$until);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($away) {
|
||||||
|
if (count($away) == count($reviewers)) {
|
||||||
|
$earliest_return = min(ipull($away, 'until'));
|
||||||
|
|
||||||
|
$message = pht(
|
||||||
|
'All reviewers are away until %s:',
|
||||||
|
date('l, M j Y', $earliest_return));
|
||||||
|
} else {
|
||||||
|
$message = pht('Some reviewers are currently away:');
|
||||||
|
}
|
||||||
|
|
||||||
|
echo tsprintf(
|
||||||
|
"%s\n\n",
|
||||||
|
$message);
|
||||||
|
|
||||||
|
$list = id(new PhutilConsoleList());
|
||||||
|
foreach ($away as $spec) {
|
||||||
|
$list->addItem(
|
||||||
|
pht(
|
||||||
|
'%s (until %s)',
|
||||||
|
$spec['name'],
|
||||||
|
date('l, M j Y', $spec['until'])));
|
||||||
|
}
|
||||||
|
|
||||||
|
echo tsprintf(
|
||||||
|
'%B',
|
||||||
|
$list->drawConsoleString());
|
||||||
|
|
||||||
|
$confirm = pht('Continue even though reviewers are unavailable?');
|
||||||
if (!phutil_console_confirm($confirm)) {
|
if (!phutil_console_confirm($confirm)) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
pht('Specify available reviewers and retry.'));
|
pht('Specify available reviewers and retry.'));
|
||||||
|
|
Loading…
Reference in a new issue