Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97580967
ManiphestTaskUnblockTransaction.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
Sun, Jan 5, 10:56
Size
3 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 10:56 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23430631
Attached To
rPH Phabricator
ManiphestTaskUnblockTransaction.php
View Options
<?php
final
class
ManiphestTaskUnblockTransaction
extends
ManiphestTaskTransactionType
{
const
TRANSACTIONTYPE
=
'unblock'
;
public
function
generateOldValue
(
$object
)
{
return
null
;
}
public
function
getActionName
()
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
$old_status
=
head
(
$old
);
$new_status
=
head
(
$new
);
$old_closed
=
ManiphestTaskStatus
::
isClosedStatus
(
$old_status
);
$new_closed
=
ManiphestTaskStatus
::
isClosedStatus
(
$new_status
);
if
(
$old_closed
&&
!
$new_closed
)
{
return
pht
(
'Block'
);
}
else
if
(!
$old_closed
&&
$new_closed
)
{
return
pht
(
'Unblock'
);
}
else
{
return
pht
(
'Blocker'
);
}
}
public
function
getTitle
()
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
$blocker_phid
=
key
(
$new
);
$old_status
=
head
(
$old
);
$new_status
=
head
(
$new
);
$old_closed
=
ManiphestTaskStatus
::
isClosedStatus
(
$old_status
);
$new_closed
=
ManiphestTaskStatus
::
isClosedStatus
(
$new_status
);
$old_name
=
ManiphestTaskStatus
::
getTaskStatusName
(
$old_status
);
$new_name
=
ManiphestTaskStatus
::
getTaskStatusName
(
$new_status
);
if
(
$this
->
getMetadataValue
(
'blocker.new'
))
{
return
pht
(
'%s created subtask %s.'
,
$this
->
renderAuthor
(),
$this
->
renderHandle
(
$blocker_phid
));
}
else
if
(
$old_closed
&&
!
$new_closed
)
{
return
pht
(
'%s reopened subtask %s as %s.'
,
$this
->
renderAuthor
(),
$this
->
renderHandle
(
$blocker_phid
),
$this
->
renderValue
(
$new_name
));
}
else
if
(!
$old_closed
&&
$new_closed
)
{
return
pht
(
'%s closed subtask %s as %s.'
,
$this
->
renderAuthor
(),
$this
->
renderHandle
(
$blocker_phid
),
$this
->
renderValue
(
$new_name
));
}
else
{
return
pht
(
'%s changed the status of subtask %s from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderHandle
(
$blocker_phid
),
$this
->
renderValue
(
$old_name
),
$this
->
renderValue
(
$new_name
));
}
}
public
function
getTitleForFeed
()
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
$blocker_phid
=
key
(
$new
);
$old_status
=
head
(
$old
);
$new_status
=
head
(
$new
);
$old_closed
=
ManiphestTaskStatus
::
isClosedStatus
(
$old_status
);
$new_closed
=
ManiphestTaskStatus
::
isClosedStatus
(
$new_status
);
$old_name
=
ManiphestTaskStatus
::
getTaskStatusName
(
$old_status
);
$new_name
=
ManiphestTaskStatus
::
getTaskStatusName
(
$new_status
);
if
(
$old_closed
&&
!
$new_closed
)
{
return
pht
(
'%s reopened %s, a subtask of %s, as %s.'
,
$this
->
renderAuthor
(),
$this
->
renderHandle
(
$blocker_phid
),
$this
->
renderObject
(),
$this
->
renderValue
(
$new_name
));
}
else
if
(!
$old_closed
&&
$new_closed
)
{
return
pht
(
'%s closed %s, a subtask of %s, as %s.'
,
$this
->
renderAuthor
(),
$this
->
renderHandle
(
$blocker_phid
),
$this
->
renderObject
(),
$this
->
renderValue
(
$new_name
));
}
else
{
return
pht
(
'%s changed the status of %s, a subtask of %s, '
.
'from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderHandle
(
$blocker_phid
),
$this
->
renderObject
(),
$this
->
renderValue
(
$old_name
),
$this
->
renderValue
(
$new_name
));
}
}
public
function
getIcon
()
{
return
'fa-shield'
;
}
public
function
shouldHideForFeed
()
{
// Hide "alice created X, a task blocking Y." from feed because it
// will almost always appear adjacent to "alice created Y".
$is_new
=
$this
->
getMetadataValue
(
'blocker.new'
);
if
(
$is_new
)
{
return
true
;
}
return
parent
::
shouldHideForFeed
();
}
}
Event Timeline
Log In to Comment