1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Split Revisions Waiting On You

Summary: Revisions you should review usually require faster response than revisions you should update or commit.

Test Plan:
/
/differential/

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4606
This commit is contained in:
vrana 2013-01-23 16:37:08 -08:00
parent 52104a4b54
commit 3a3ab08aba
4 changed files with 33 additions and 17 deletions

View file

@ -73,13 +73,14 @@ final class PhabricatorApplicationDifferential extends PhabricatorApplication {
->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
->execute();
list($active, $waiting) = DifferentialRevisionQuery::splitResponsible(
$revisions,
array($user->getPHID()));
list($blocking, $active, $waiting) =
DifferentialRevisionQuery::splitResponsible(
$revisions,
array($user->getPHID()));
$status = array();
$active = count($active);
$active = count($blocking) + count($active);
$type = $active
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
: PhabricatorApplicationStatusView::TYPE_EMPTY;

View file

@ -435,9 +435,19 @@ final class DifferentialRevisionListController extends DifferentialController {
$views = array();
switch ($filter) {
case 'active':
list($active, $waiting) = DifferentialRevisionQuery::splitResponsible(
$revisions,
$user_phids);
list($blocking, $active, $waiting) =
DifferentialRevisionQuery::splitResponsible(
$revisions,
$user_phids);
$view = id(clone $template)
->setHighlightAge(true)
->setRevisions($blocking)
->loadAssets();
$views[] = array(
'title' => pht('Blocking Others'),
'view' => $view,
);
$view = id(clone $template)
->setHighlightAge(true)

View file

@ -892,13 +892,14 @@ final class DifferentialRevisionQuery {
}
public static function splitResponsible(array $revisions, array $user_phids) {
$blocking = array();
$active = array();
$waiting = array();
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
// Bucket revisions into $active (revisions you need to do something
// about) and $waiting (revisions you're waiting on someone else to do
// something about).
// Bucket revisions into $blocking (revisions where you are blocking
// others), $active (revisions you need to do something about) and $waiting
// (revisions you're waiting on someone else to do something about).
foreach ($revisions as $revision) {
$needs_review = ($revision->getStatus() == $status_review);
$filter_is_author = in_array($revision->getAuthorPHID(), $user_phids);
@ -907,13 +908,17 @@ final class DifferentialRevisionQuery {
// true, the user needs to act on it. Otherwise, they're waiting on
// it.
if ($needs_review ^ $filter_is_author) {
$active[] = $revision;
if ($needs_review) {
$blocking[] = $revision;
} else {
$active[] = $revision;
}
} else {
$waiting[] = $revision;
}
}
return array($active, $waiting);
return array($blocking, $active, $waiting);
}

View file

@ -183,11 +183,11 @@ final class PhabricatorDirectoryMainController
$revision_query->setLimit(null);
$revisions = $revision_query->execute();
list($active, $waiting) = DifferentialRevisionQuery::splitResponsible(
$revisions,
array($user_phid));
list($blocking, $active, ) = DifferentialRevisionQuery::splitResponsible(
$revisions,
array($user_phid));
if (!$active) {
if (!$blocking && !$active) {
return $this->renderMiniPanel(
'No Waiting Revisions',
'No revisions are waiting on you.');
@ -208,7 +208,7 @@ final class PhabricatorDirectoryMainController
$revision_view = id(new DifferentialRevisionListView())
->setHighlightAge(true)
->setRevisions($active)
->setRevisions(array_merge($blocking, $active))
->setFields(DifferentialRevisionListView::getDefaultFields())
->setUser($user)
->loadAssets();