Differential D17531 Diff 42168 src/applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php
| Show All 23 Lines | protected function buildResultGroups( | ||||
| if (!$phids) { | if (!$phids) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'You can not bucket results by required action without '. | 'You can not bucket results by required action without '. | ||||
| 'specifying "Responsible Users".')); | 'specifying "Responsible Users".')); | ||||
| } | } | ||||
| $phids = array_fuse($phids); | $phids = array_fuse($phids); | ||||
| // Before continuing, throw away any revisions which responsible users | |||||
| // have explicitly resigned from. | |||||
| // The goal is to allow users to resign from revisions they don't want to | |||||
| // review to get these revisions off their dashboard, even if there are | |||||
| // other project or package reviewers which they have authority over. | |||||
| $this->filterResigned($phids); | |||||
| $groups = array(); | $groups = array(); | ||||
| $groups[] = $this->newGroup() | $groups[] = $this->newGroup() | ||||
| ->setName(pht('Must Review')) | ->setName(pht('Must Review')) | ||||
| ->setKey(self::KEY_MUSTREVIEW) | ->setKey(self::KEY_MUSTREVIEW) | ||||
| ->setNoDataString(pht('No revisions are blocked on your review.')) | ->setNoDataString(pht('No revisions are blocked on your review.')) | ||||
| ->setObjects($this->filterMustReview($phids)); | ->setObjects($this->filterMustReview($phids)); | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | foreach ($objects as $key => $object) { | ||||
| $results[$key] = $object; | $results[$key] = $object; | ||||
| unset($this->objects[$key]); | unset($this->objects[$key]); | ||||
| } | } | ||||
| return $results; | return $results; | ||||
| } | } | ||||
| private function filterResigned(array $phids) { | |||||
| $resigned = array( | |||||
| DifferentialReviewerStatus::STATUS_RESIGNED, | |||||
| ); | |||||
| $resigned = array_fuse($resigned); | |||||
| $objects = $this->getRevisionsNotAuthored($this->objects, $phids); | |||||
| $results = array(); | |||||
| foreach ($objects as $key => $object) { | |||||
| if (!$this->hasReviewersWithStatus($object, $phids, $resigned)) { | |||||
| continue; | |||||
| } | |||||
| $results[$key] = $object; | |||||
| unset($this->objects[$key]); | |||||
| } | |||||
| return $results; | |||||
| } | |||||
| } | } | ||||