Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96126790
ManiphestTaskStatusHeraldAction.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, Dec 22, 22:46
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 22:46 (2 d)
Engine
blob
Format
Raw Data
Handle
23128018
Attached To
rPH Phabricator
ManiphestTaskStatusHeraldAction.php
View Options
<?php
final
class
ManiphestTaskStatusHeraldAction
extends
HeraldAction
{
const
ACTIONCONST
=
'maniphest.status'
;
const
DO_STATUS
=
'do.status'
;
public
function
supportsObject
(
$object
)
{
return
(
$object
instanceof
ManiphestTask
);
}
public
function
getActionGroupKey
()
{
return
HeraldApplicationActionGroup
::
ACTIONGROUPKEY
;
}
public
function
getHeraldActionName
()
{
return
pht
(
'Change status to'
);
}
public
function
supportsRuleType
(
$rule_type
)
{
return
(
$rule_type
!=
HeraldRuleTypeConfig
::
RULE_TYPE_PERSONAL
);
}
public
function
applyEffect
(
$object
,
HeraldEffect
$effect
)
{
$status
=
head
(
$effect
->
getTarget
());
if
(!
$status
)
{
$this
->
logEffect
(
self
::
DO_STANDARD_EMPTY
);
return
;
}
$adapter
=
$this
->
getAdapter
();
$object
=
$adapter
->
getObject
();
$current
=
$object
->
getStatus
();
if
(
$current
==
$status
)
{
$this
->
logEffect
(
self
::
DO_STANDARD_NO_EFFECT
,
$status
);
return
;
}
$xaction
=
$adapter
->
newTransaction
()
->
setTransactionType
(
ManiphestTaskStatusTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
$status
);
$adapter
->
queueTransaction
(
$xaction
);
$this
->
logEffect
(
self
::
DO_STATUS
,
$status
);
}
public
function
getHeraldActionStandardType
()
{
return
self
::
STANDARD_PHID_LIST
;
}
public
function
renderActionDescription
(
$value
)
{
$status
=
head
(
$value
);
$name
=
ManiphestTaskStatus
::
getTaskStatusName
(
$status
);
return
pht
(
'Change status to: %s.'
,
$name
);
}
protected
function
getDatasource
()
{
return
id
(
new
ManiphestTaskStatusDatasource
())
->
setLimit
(
1
);
}
protected
function
getDatasourceValueMap
()
{
return
ManiphestTaskStatus
::
getTaskStatusMap
();
}
protected
function
getActionEffectMap
()
{
return
array
(
self
::
DO_STATUS
=>
array
(
'icon'
=>
'fa-pencil'
,
'color'
=>
'green'
,
'name'
=>
pht
(
'Changed Task Status'
),
),
);
}
protected
function
renderActionEffectDescription
(
$type
,
$data
)
{
switch
(
$type
)
{
case
self
::
DO_STATUS
:
return
pht
(
'Changed task status to "%s".'
,
ManiphestTaskStatus
::
getTaskStatusName
(
$data
));
}
}
}
Event Timeline
Log In to Comment