Ejemplo n.º 1
0
 private function loadBloggers(array $blogs)
 {
     assert_instances_of($blogs, 'PhameBlog');
     $blog_phids = mpull($blogs, 'getPHID');
     $edge_types = array(PhabricatorEdgeConfig::TYPE_BLOG_HAS_BLOGGER);
     $query = new PhabricatorEdgeQuery();
     $query->withSourcePHIDs($blog_phids)->withEdgeTypes($edge_types)->execute();
     $all_blogger_phids = $query->getDestinationPHIDs($blog_phids, $edge_types);
     $handles = id(new PhabricatorObjectHandleData($all_blogger_phids))->loadHandles();
     foreach ($blogs as $blog) {
         $blogger_phids = $query->getDestinationPHIDs(array($blog->getPHID()), $edge_types);
         $blog->attachBloggers(array_select_keys($handles, $blogger_phids));
     }
 }
 private function newMentionsTab(ManiphestTask $task, PhabricatorEdgeQuery $edge_query)
 {
     $in_type = PhabricatorObjectMentionedByObjectEdgeType::EDGECONST;
     $out_type = PhabricatorObjectMentionsObjectEdgeType::EDGECONST;
     $in_phids = $edge_query->getDestinationPHIDs(array(), array($in_type));
     $out_phids = $edge_query->getDestinationPHIDs(array(), array($out_type));
     // Filter out any mentioned users from the list. These are not generally
     // very interesting to show in a relationship summary since they usually
     // end up as subscribers anyway.
     $user_type = PhabricatorPeopleUserPHIDType::TYPECONST;
     foreach ($out_phids as $key => $out_phid) {
         if (phid_get_type($out_phid) == $user_type) {
             unset($out_phids[$key]);
         }
     }
     if (!$in_phids && !$out_phids) {
         return null;
     }
     $viewer = $this->getViewer();
     $in_handles = $viewer->loadHandles($in_phids);
     $out_handles = $viewer->loadHandles($out_phids);
     $in_handles = $this->getCompleteHandles($in_handles);
     $out_handles = $this->getCompleteHandles($out_handles);
     if (!count($in_handles) && !count($out_handles)) {
         return null;
     }
     $view = new PHUIPropertyListView();
     if (count($in_handles)) {
         $view->addProperty(pht('Mentioned In'), $in_handles->renderList());
     }
     if (count($out_handles)) {
         $view->addProperty(pht('Mentioned Here'), $out_handles->renderList());
     }
     return id(new PHUITabView())->setName(pht('Mentions'))->setKey('mentions')->appendChild($view);
 }