Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / maniphest / relationship / ManiphestTaskCloseAsDuplicateRelationship.php
blobe973e86e76ddedf2e12bc86038cb1e654262b37d
1 <?php
3 final class ManiphestTaskCloseAsDuplicateRelationship
4 extends ManiphestTaskRelationship {
6 const RELATIONSHIPKEY = 'task.close-as-duplicate';
8 public function getEdgeConstant() {
9 return ManiphestTaskIsDuplicateOfTaskEdgeType::EDGECONST;
12 protected function getActionName() {
13 return pht('Close As Duplicate');
16 protected function getActionIcon() {
17 return 'fa-times';
20 public function canRelateObjects($src, $dst) {
21 return ($dst instanceof ManiphestTask);
24 public function shouldAppearInActionMenu() {
25 return false;
28 public function getDialogTitleText() {
29 return pht('Close As Duplicate');
32 public function getDialogHeaderText() {
33 return pht('Close This Task As a Duplicate Of');
36 public function getDialogButtonText() {
37 return pht('Merge Into Selected Task');
40 protected function newRelationshipSource() {
41 return id(new ManiphestTaskRelationshipSource())
42 ->setSelectedFilter('open');
45 public function getRequiredRelationshipCapabilities() {
46 return array(
47 PhabricatorPolicyCapability::CAN_VIEW,
48 PhabricatorPolicyCapability::CAN_EDIT,
52 public function canUndoRelationship() {
53 return false;
56 public function getMaximumSelectionSize() {
57 return 1;
60 public function willUpdateRelationships($object, array $add, array $rem) {
61 $task = head($add);
62 return $this->newMergeIntoTransactions($task);
65 public function didUpdateRelationships($object, array $add, array $rem) {
66 $viewer = $this->getViewer();
67 $content_source = $this->getContentSource();
69 $task = head($add);
70 $xactions = $this->newMergeFromTransactions(array($object));
72 $task->getApplicationTransactionEditor()
73 ->setActor($viewer)
74 ->setContentSource($content_source)
75 ->setContinueOnMissingFields(true)
76 ->setContinueOnNoEffect(true)
77 ->applyTransactions($task, $xactions);