Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894016
DifferentialRevisionHoldDraftTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
DifferentialRevisionHoldDraftTransaction.php
View Options
<?php
final
class
DifferentialRevisionHoldDraftTransaction
extends
DifferentialRevisionTransactionType
{
const
TRANSACTIONTYPE
=
'draft'
;
const
EDITKEY
=
'draft'
;
public
function
generateOldValue
(
$object
)
{
return
(bool)
$object
->
getHoldAsDraft
(
)
;
}
public
function
generateNewValue
(
$object
,
$value
)
{
return
(bool)
$value
;
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setHoldAsDraft
(
$value
)
;
// If draft isn't the default state but we're creating a new revision
// and holding it as a draft, put it in draft mode. See PHI206.
// TODO: This can probably be removed once Draft is the universal default.
if
(
$this
->
isNewObject
(
)
)
{
if
(
$object
->
isNeedsReview
(
)
)
{
$object
->
setModernRevisionStatus
(
DifferentialRevisionStatus
::
DRAFT
)
->
setShouldBroadcast
(
false
)
;
}
}
}
public
function
getTitle
(
)
{
if
(
$this
->
getNewValue
(
)
)
{
return
pht
(
'%s held this revision as a draft.'
,
$this
->
renderAuthor
(
)
)
;
}
else
{
return
pht
(
'%s set this revision to automatically submit once builds complete.'
,
$this
->
renderAuthor
(
)
)
;
}
}
public
function
getTitleForFeed
(
)
{
if
(
$this
->
getNewValue
(
)
)
{
return
pht
(
'%s held %s as a draft.'
,
$this
->
renderAuthor
(
)
,
$this
->
renderObject
(
)
)
;
}
else
{
return
pht
(
'%s set %s to automatically submit once builds complete.'
,
$this
->
renderAuthor
(
)
,
$this
->
renderObject
(
)
)
;
}
}
public
function
getTransactionTypeForConduit
(
$xaction
)
{
return
'draft'
;
}
public
function
getFieldValuesForConduit
(
$xaction
,
$data
)
{
return
array
(
'old'
=>
$xaction
->
getOldValue
(
)
,
'new'
=>
$xaction
->
getNewValue
(
)
,
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Jan 19 2025, 19:15 (5 w, 4 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127866
Default Alt Text
DifferentialRevisionHoldDraftTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment