Page MenuHomePhabricator

D16295.diff
No OneTemporary

D16295.diff

diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -87,12 +87,25 @@
->addPropertySection(pht('Description'), $description)
->addPropertySection(pht('Details'), $details);
+ $graph_limit = 100;
$task_graph = id(new ManiphestTaskGraph())
->setViewer($viewer)
->setSeedPHID($task->getPHID())
+ ->setLimit($graph_limit)
->loadGraph();
if (!$task_graph->isEmpty()) {
- $graph_table = $task_graph->newGraphTable();
+ if ($task_graph->isOverLimit()) {
+ $message = pht(
+ 'Task graph too large to display (this task is connected to '.
+ 'more than %s other tasks).',
+ $graph_limit);
+ $message = phutil_tag('em', array(), $message);
+ $graph_table = id(new PHUIPropertyListView())
+ ->addTextContent($message);
+ } else {
+ $graph_table = $task_graph->newGraphTable();
+ }
+
$view->addPropertySection(pht('Task Graph'), $graph_table);
}
diff --git a/src/infrastructure/graph/PhabricatorObjectGraph.php b/src/infrastructure/graph/PhabricatorObjectGraph.php
--- a/src/infrastructure/graph/PhabricatorObjectGraph.php
+++ b/src/infrastructure/graph/PhabricatorObjectGraph.php
@@ -9,6 +9,7 @@
private $seedPHID;
private $objects;
private $loadEntireGraph = false;
+ private $limit;
public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
@@ -23,6 +24,15 @@
return $this->viewer;
}
+ public function setLimit($limit) {
+ $this->limit = $limit;
+ return $this;
+ }
+
+ public function getLimit() {
+ return $this->limit;
+ }
+
abstract protected function getEdgeTypes();
abstract protected function getParentEdgeType();
abstract protected function newQuery();
@@ -44,6 +54,16 @@
return (count($this->getNodes()) <= 2);
}
+ final public function isOverLimit() {
+ $limit = $this->getLimit();
+
+ if (!$limit) {
+ return false;
+ }
+
+ return (count($this->edgeReach) > $limit);
+ }
+
final public function getEdges($type) {
$edges = idx($this->edges, $type, array());
@@ -72,6 +92,10 @@
}
final protected function loadEdges(array $nodes) {
+ if ($this->isOverLimit()) {
+ return array_fill_keys($nodes, array());
+ }
+
$edge_types = $this->getEdgeTypes();
$query = id(new PhabricatorEdgeQuery())

File Metadata

Mime Type
text/plain
Expires
Oct 17 2024, 2:03 PM (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710291
Default Alt Text
D16295.diff (2 KB)

Event Timeline