mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-02 01:48:23 +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:
parent
52104a4b54
commit
3a3ab08aba
4 changed files with 33 additions and 17 deletions
|
@ -73,13 +73,14 @@ final class PhabricatorApplicationDifferential extends PhabricatorApplication {
|
||||||
->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
|
->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
list($active, $waiting) = DifferentialRevisionQuery::splitResponsible(
|
list($blocking, $active, $waiting) =
|
||||||
$revisions,
|
DifferentialRevisionQuery::splitResponsible(
|
||||||
array($user->getPHID()));
|
$revisions,
|
||||||
|
array($user->getPHID()));
|
||||||
|
|
||||||
$status = array();
|
$status = array();
|
||||||
|
|
||||||
$active = count($active);
|
$active = count($blocking) + count($active);
|
||||||
$type = $active
|
$type = $active
|
||||||
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
|
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
|
||||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||||
|
|
|
@ -435,9 +435,19 @@ final class DifferentialRevisionListController extends DifferentialController {
|
||||||
$views = array();
|
$views = array();
|
||||||
switch ($filter) {
|
switch ($filter) {
|
||||||
case 'active':
|
case 'active':
|
||||||
list($active, $waiting) = DifferentialRevisionQuery::splitResponsible(
|
list($blocking, $active, $waiting) =
|
||||||
$revisions,
|
DifferentialRevisionQuery::splitResponsible(
|
||||||
$user_phids);
|
$revisions,
|
||||||
|
$user_phids);
|
||||||
|
|
||||||
|
$view = id(clone $template)
|
||||||
|
->setHighlightAge(true)
|
||||||
|
->setRevisions($blocking)
|
||||||
|
->loadAssets();
|
||||||
|
$views[] = array(
|
||||||
|
'title' => pht('Blocking Others'),
|
||||||
|
'view' => $view,
|
||||||
|
);
|
||||||
|
|
||||||
$view = id(clone $template)
|
$view = id(clone $template)
|
||||||
->setHighlightAge(true)
|
->setHighlightAge(true)
|
||||||
|
|
|
@ -892,13 +892,14 @@ final class DifferentialRevisionQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function splitResponsible(array $revisions, array $user_phids) {
|
public static function splitResponsible(array $revisions, array $user_phids) {
|
||||||
|
$blocking = array();
|
||||||
$active = array();
|
$active = array();
|
||||||
$waiting = array();
|
$waiting = array();
|
||||||
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
|
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
|
||||||
|
|
||||||
// Bucket revisions into $active (revisions you need to do something
|
// Bucket revisions into $blocking (revisions where you are blocking
|
||||||
// about) and $waiting (revisions you're waiting on someone else to do
|
// others), $active (revisions you need to do something about) and $waiting
|
||||||
// something about).
|
// (revisions you're waiting on someone else to do something about).
|
||||||
foreach ($revisions as $revision) {
|
foreach ($revisions as $revision) {
|
||||||
$needs_review = ($revision->getStatus() == $status_review);
|
$needs_review = ($revision->getStatus() == $status_review);
|
||||||
$filter_is_author = in_array($revision->getAuthorPHID(), $user_phids);
|
$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
|
// true, the user needs to act on it. Otherwise, they're waiting on
|
||||||
// it.
|
// it.
|
||||||
if ($needs_review ^ $filter_is_author) {
|
if ($needs_review ^ $filter_is_author) {
|
||||||
$active[] = $revision;
|
if ($needs_review) {
|
||||||
|
$blocking[] = $revision;
|
||||||
|
} else {
|
||||||
|
$active[] = $revision;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$waiting[] = $revision;
|
$waiting[] = $revision;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($active, $waiting);
|
return array($blocking, $active, $waiting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -183,11 +183,11 @@ final class PhabricatorDirectoryMainController
|
||||||
$revision_query->setLimit(null);
|
$revision_query->setLimit(null);
|
||||||
$revisions = $revision_query->execute();
|
$revisions = $revision_query->execute();
|
||||||
|
|
||||||
list($active, $waiting) = DifferentialRevisionQuery::splitResponsible(
|
list($blocking, $active, ) = DifferentialRevisionQuery::splitResponsible(
|
||||||
$revisions,
|
$revisions,
|
||||||
array($user_phid));
|
array($user_phid));
|
||||||
|
|
||||||
if (!$active) {
|
if (!$blocking && !$active) {
|
||||||
return $this->renderMiniPanel(
|
return $this->renderMiniPanel(
|
||||||
'No Waiting Revisions',
|
'No Waiting Revisions',
|
||||||
'No revisions are waiting on you.');
|
'No revisions are waiting on you.');
|
||||||
|
@ -208,7 +208,7 @@ final class PhabricatorDirectoryMainController
|
||||||
|
|
||||||
$revision_view = id(new DifferentialRevisionListView())
|
$revision_view = id(new DifferentialRevisionListView())
|
||||||
->setHighlightAge(true)
|
->setHighlightAge(true)
|
||||||
->setRevisions($active)
|
->setRevisions(array_merge($blocking, $active))
|
||||||
->setFields(DifferentialRevisionListView::getDefaultFields())
|
->setFields(DifferentialRevisionListView::getDefaultFields())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->loadAssets();
|
->loadAssets();
|
||||||
|
|
Loading…
Add table
Reference in a new issue