Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3015908
D25897.1740736880.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
D25897.1740736880.diff
View Options
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -40,6 +40,85 @@
return $this;
}
+
+ private function getCompleteHandles(PhabricatorHandleList $handles) {
+ $phids = array();
+
+ foreach ($handles as $phid => $handle) {
+ if (!$handle->isComplete()) {
+ continue;
+ }
+ $phids[] = $phid;
+ }
+
+ return $handles->newSublist($phids);
+ }
+
+ private function newMentionsTab(
+ DifferentialRevision $revision) {
+
+ $phid = $revision->getPHID();
+
+ $edge_types = array(
+ PhabricatorObjectMentionedByObjectEdgeType::EDGECONST,
+ PhabricatorObjectMentionsObjectEdgeType::EDGECONST,
+ );
+
+ $edge_query = id(new PhabricatorEdgeQuery())
+ ->withSourcePHIDs(array($phid))
+ ->withEdgeTypes($edge_types);
+
+ $edge_query->execute();
+
+ $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);
+ }
+
+
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$this->revisionID = $request->getURIData('id');
@@ -488,6 +567,8 @@
->setKey('history')
->appendChild($history));
+ $tab_group->addTab($this->newMentionsTab($revision));
+
$filetree = id(new DifferentialFileTreeEngine())
->setViewer($viewer);
$filetree_collapsed = !$filetree->getIsVisible();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 28, 10:01 (20 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1194643
Default Alt Text
D25897.1740736880.diff (3 KB)
Attached To
Mode
D25897: Added a Mentions tab to the Differential Revision View
Attached
Detach File
Event Timeline
Log In to Comment