Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14444991
D18037.id43393.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D18037.id43393.diff
View Options
diff --git a/resources/sql/autopatches/20170528.maniphestdupes.php b/resources/sql/autopatches/20170528.maniphestdupes.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20170528.maniphestdupes.php
@@ -0,0 +1,21 @@
+<?php
+
+$table = new ManiphestTransaction();
+$type = ManiphestTaskIsDuplicateOfTaskEdgeType::EDGECONST;
+
+foreach (new LiskMigrationIterator($table) as $txn) {
+ if ($txn->getTransactionType() != 'mergedinto') {
+ continue;
+ }
+
+ $src_phid = $txn->getObjectPHID();
+ $dst_phid = $txn->getNewValue();
+
+ try {
+ $editor = id(new PhabricatorEdgeEditor())
+ ->addEdge($src_phid, $type, $dst_phid)
+ ->save();
+ } catch (PhabricatorEdgeCycleException $ex) {
+ // Some earlier or later merge made this invalid, just skip it.
+ }
+}
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
@@ -36,6 +36,7 @@
ManiphestTaskHasMockEdgeType::EDGECONST,
PhabricatorObjectMentionedByObjectEdgeType::EDGECONST,
PhabricatorObjectMentionsObjectEdgeType::EDGECONST,
+ ManiphestTaskHasDuplicateTaskEdgeType::EDGECONST,
);
$phid = $task->getPHID();
@@ -159,6 +160,7 @@
$related_tabs[] = $this->newMocksTab($task, $query);
$related_tabs[] = $this->newMentionsTab($task, $query);
+ $related_tabs[] = $this->newDuplicatesTab($task, $query);
$tab_view = null;
@@ -553,6 +555,32 @@
->appendChild($view);
}
+ private function newDuplicatesTab(
+ ManiphestTask $task,
+ PhabricatorEdgeQuery $edge_query) {
+
+ $in_type = ManiphestTaskHasDuplicateTaskEdgeType::EDGECONST;
+ $in_phids = $edge_query->getDestinationPHIDs(array(), array($in_type));
+
+ $viewer = $this->getViewer();
+ $in_handles = $viewer->loadHandles($in_phids);
+ $in_handles = $this->getCompleteHandles($in_handles);
+
+ $view = new PHUIPropertyListView();
+
+ if (!count($in_handles)) {
+ return null;
+ }
+
+ $view->addProperty(
+ pht('Duplicates Merged Here'), $in_handles->renderList());
+
+ return id(new PHUITabView())
+ ->setName(pht('Duplicates'))
+ ->setKey('duplicates')
+ ->appendChild($view);
+ }
+
private function getCompleteHandles(PhabricatorHandleList $handles) {
$phids = array();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 11:51 AM (9 h, 16 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6931742
Default Alt Text
D18037.id43393.diff (2 KB)
Attached To
Mode
D18037: Show task duplicates as related objects in Maniphest and migrate old duplicates
Attached
Detach File
Event Timeline
Log In to Comment