Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1003226
AddCommentHeraldAction.php
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
epriestley
Nov 25 2015, 8:59 PM
2015-11-25 20:59:47 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
AddCommentHeraldAction.php
View Options
<?php
final
class
AddCommentHeraldAction
extends
HeraldAction
{
const
ACTIONCONST
=
'custom.transactions.comment'
;
const
DO_COMMENT
=
'do.comment'
;
public
function
getHeraldActionName
()
{
return
pht
(
'Add comment'
);
}
public
function
getActionGroupKey
()
{
return
HeraldUtilityActionGroup
::
ACTIONGROUPKEY
;
}
public
function
supportsObject
(
$object
)
{
if
(!(
$object
instanceof
PhabricatorApplicationTransactionInterface
))
{
return
false
;
}
$xaction
=
$object
->
getApplicationTransactionTemplate
();
try
{
$comment
=
$xaction
->
getApplicationTransactionCommentObject
();
if
(!
$comment
)
{
return
false
;
}
}
catch
(
Exception
$ex
)
{
return
false
;
}
return
true
;
}
public
function
supportsRuleType
(
$rule_type
)
{
return
true
;
}
public
function
applyEffect
(
$object
,
HeraldEffect
$effect
)
{
$adapter
=
$this
->
getAdapter
();
$comment_text
=
$effect
->
getTarget
();
$comment
=
$adapter
->
newTransaction
()
->
getApplicationTransactionCommentObject
()
->
setContent
(
$comment_text
);
$xaction
=
$adapter
->
newTransaction
()
->
setTransactionType
(
PhabricatorTransactions
::
TYPE_COMMENT
)
->
attachComment
(
$comment
);
$adapter
->
queueTransaction
(
$xaction
);
$this
->
logEffect
(
self
::
DO_COMMENT
);
}
public
function
getHeraldActionStandardType
()
{
return
self
::
STANDARD_TEXT
;
}
public
function
renderActionDescription
(
$value
)
{
return
pht
(
'Add comment: %s'
,
$value
);
}
protected
function
getActionEffectMap
()
{
return
array
(
self
::
DO_COMMENT
=>
array
(
'icon'
=>
'fa-comment'
,
'color'
=>
'blue'
,
'name'
=>
pht
(
'Added comment.'
),
),
);
}
protected
function
renderActionEffectDescription
(
$type
,
$data
)
{
switch
(
$type
)
{
case
self
::
DO_COMMENT
:
return
pht
(
'Added comment.'
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/2l/72/jctoq4gb2zesq7pm
Default Alt Text
AddCommentHeraldAction.php (1 KB)
Attached To
Mode
P1895 AddCommentHeraldAction.php
Attached
Detach File
Event Timeline
Log In to Comment