Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90385705
ManiphestTaskCloseAsDuplicateRelationship.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 1, 04:36
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Nov 3, 04:36 (2 d)
Engine
blob
Format
Raw Data
Handle
22059868
Attached To
rPH Phabricator
ManiphestTaskCloseAsDuplicateRelationship.php
View Options
<?php
final
class
ManiphestTaskCloseAsDuplicateRelationship
extends
ManiphestTaskRelationship
{
const
RELATIONSHIPKEY
=
'task.close-as-duplicate'
;
public
function
getEdgeConstant
()
{
return
ManiphestTaskIsDuplicateOfTaskEdgeType
::
EDGECONST
;
}
protected
function
getActionName
()
{
return
pht
(
'Close As Duplicate'
);
}
protected
function
getActionIcon
()
{
return
'fa-times'
;
}
public
function
canRelateObjects
(
$src
,
$dst
)
{
return
(
$dst
instanceof
ManiphestTask
);
}
public
function
shouldAppearInActionMenu
()
{
return
false
;
}
public
function
getDialogTitleText
()
{
return
pht
(
'Close As Duplicate'
);
}
public
function
getDialogHeaderText
()
{
return
pht
(
'Close This Task As a Duplicate Of'
);
}
public
function
getDialogButtonText
()
{
return
pht
(
'Merge Into Selected Task'
);
}
protected
function
newRelationshipSource
()
{
return
new
ManiphestTaskRelationshipSource
();
}
public
function
getRequiredRelationshipCapabilities
()
{
return
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
);
}
public
function
canUndoRelationship
()
{
return
false
;
}
public
function
willUpdateRelationships
(
$object
,
array
$add
,
array
$rem
)
{
// TODO: Communicate this in the UI before users hit this error.
if
(
count
(
$add
)
>
1
)
{
throw
new
Exception
(
pht
(
'A task can only be closed as a duplicate of exactly one other '
.
'task.'
));
}
$task
=
head
(
$add
);
return
$this
->
newMergeIntoTransactions
(
$task
);
}
public
function
didUpdateRelationships
(
$object
,
array
$add
,
array
$rem
)
{
$viewer
=
$this
->
getViewer
();
$content_source
=
$this
->
getContentSource
();
$task
=
head
(
$add
);
$xactions
=
$this
->
newMergeFromTransactions
(
array
(
$object
));
$task
->
getApplicationTransactionEditor
()
->
setActor
(
$viewer
)
->
setContentSource
(
$content_source
)
->
setContinueOnMissingFields
(
true
)
->
setContinueOnNoEffect
(
true
)
->
applyTransactions
(
$task
,
$xactions
);
}
}
Event Timeline
Log In to Comment