mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-12 00:26:13 +01:00
42d49be47b
Summary: Ref T10939. Ref T4144. This splits the existing buckets ("Blocking Others", "Action Required", "Waiting on Others") into 6-7 buckets with a stronger focus on what the next action you need to take is. See T10939#175423 for some discussion. Overall, I think some of the root problems here are caused by reviewer laziness and shotgun review workflows (where a ton of people get automatically added to everything, probably unnecessarily), but these buckets haven't been updated since the introduction of blocking reviewers or project/package reviewers and I think splitting the 3 buckets into 6 buckets isn't unreasonable, even though it's kind of a lot of buckets and the root problem here is approximately "I want to ignore a bunch of stuff on my dashboard". I didn't remove the old bucketing code yet since it's still in use on the default homepage. This also isn't quite right until I fix the tokenizer to work properly, since it won't bucket project/package reviewers accurately. Test Plan: {F1395972} Reviewers: chad Reviewed By: chad Maniphest Tasks: T4144, T10939 Differential Revision: https://secure.phabricator.com/D15924
77 lines
1.7 KiB
PHP
77 lines
1.7 KiB
PHP
<?php
|
|
|
|
abstract class DifferentialRevisionResultBucket
|
|
extends PhabricatorSearchResultBucket {
|
|
|
|
public static function getAllResultBuckets() {
|
|
return id(new PhutilClassMapQuery())
|
|
->setAncestorClass(__CLASS__)
|
|
->setUniqueMethod('getResultBucketKey')
|
|
->execute();
|
|
}
|
|
|
|
protected function getRevisionsUnderReview(array $objects, array $phids) {
|
|
$results = array();
|
|
|
|
$objects = $this->getRevisionsNotAuthored($objects, $phids);
|
|
|
|
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
|
|
foreach ($objects as $key => $object) {
|
|
if ($object->getStatus() !== $status_review) {
|
|
continue;
|
|
}
|
|
|
|
$results[$key] = $object;
|
|
}
|
|
|
|
return $results;
|
|
}
|
|
|
|
protected function getRevisionsAuthored(array $objects, array $phids) {
|
|
$results = array();
|
|
|
|
foreach ($objects as $key => $object) {
|
|
if (isset($phids[$object->getAuthorPHID()])) {
|
|
$results[$key] = $object;
|
|
}
|
|
}
|
|
|
|
return $results;
|
|
}
|
|
|
|
protected function getRevisionsNotAuthored(array $objects, array $phids) {
|
|
$results = array();
|
|
|
|
foreach ($objects as $key => $object) {
|
|
if (empty($phids[$object->getAuthorPHID()])) {
|
|
$results[$key] = $object;
|
|
}
|
|
}
|
|
|
|
return $results;
|
|
}
|
|
|
|
protected function hasReviewersWithStatus(
|
|
DifferentialRevision $revision,
|
|
array $phids,
|
|
array $statuses) {
|
|
|
|
foreach ($revision->getReviewerStatus() as $reviewer) {
|
|
$reviewer_phid = $reviewer->getReviewerPHID();
|
|
if (empty($phids[$reviewer_phid])) {
|
|
continue;
|
|
}
|
|
|
|
$status = $reviewer->getStatus();
|
|
if (empty($statuses[$status])) {
|
|
continue;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
}
|