Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101484577
HeraldRuleEditTransaction.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
Mon, Feb 10, 22:04
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Feb 12, 22:04 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24161243
Attached To
rPH Phabricator
HeraldRuleEditTransaction.php
View Options
<?php
final
class
HeraldRuleEditTransaction
extends
HeraldRuleTransactionType
{
const
TRANSACTIONTYPE
=
'herald:edit'
;
public
function
generateOldValue
(
$object
)
{
return
id
(
new
HeraldRuleSerializer
())
->
serializeRule
(
$object
);
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$new_state
=
id
(
new
HeraldRuleSerializer
())
->
deserializeRuleComponents
(
$value
);
$object
->
setMustMatchAll
((
int
)
$new_state
[
'match_all'
]);
$object
->
attachConditions
(
$new_state
[
'conditions'
]);
$object
->
attachActions
(
$new_state
[
'actions'
]);
$new_repetition
=
$new_state
[
'repetition_policy'
];
$object
->
setRepetitionPolicyStringConstant
(
$new_repetition
);
}
public
function
applyExternalEffects
(
$object
,
$value
)
{
$object
->
saveConditions
(
$object
->
getConditions
());
$object
->
saveActions
(
$object
->
getActions
());
}
public
function
getTitle
()
{
return
pht
(
'%s edited this rule.'
,
$this
->
renderAuthor
());
}
public
function
hasChangeDetailView
()
{
return
true
;
}
public
function
newChangeDetailView
()
{
$viewer
=
$this
->
getViewer
();
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
$json
=
new
PhutilJSON
();
$old_json
=
$json
->
encodeFormatted
(
$old
);
$new_json
=
$json
->
encodeFormatted
(
$new
);
return
id
(
new
PhabricatorApplicationTransactionTextDiffDetailView
())
->
setViewer
(
$viewer
)
->
setOldText
(
$old_json
)
->
setNewText
(
$new_json
);
}
}
Event Timeline
Log In to Comment