protected function willFilterPage(array $items) { $source_phids = mpull($items, 'getSourcePHID'); // NOTE: We always load sources, even if the viewer can't formally see // them. If they can see the item, they're allowed to be aware of the // source in some sense. $sources = id(new NuanceSourceQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($source_phids)->execute(); $sources = mpull($sources, null, 'getPHID'); foreach ($items as $key => $item) { $source = idx($sources, $item->getSourcePHID()); if (!$source) { $this->didRejectResult($items[$key]); unset($items[$key]); continue; } $item->attachSource($source); } $type_map = NuanceItemType::getAllItemTypes(); foreach ($items as $key => $item) { $type = idx($type_map, $item->getItemType()); if (!$type) { $this->didRejectResult($items[$key]); unset($items[$key]); continue; } $item->attachImplementation($type); } return $items; }