Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96146449
DifferentialRevisionPlanChangesTransaction.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, Dec 23, 02:58
Size
2 KB
Mime Type
text/x-php
Expires
Wed, Dec 25, 02:58 (1 d, 19 h)
Engine
blob
Format
Raw Data
Handle
23110109
Attached To
rPH Phabricator
DifferentialRevisionPlanChangesTransaction.php
View Options
<?php
final
class
DifferentialRevisionPlanChangesTransaction
extends
DifferentialRevisionActionTransaction
{
const
TRANSACTIONTYPE
=
'differential.revision.plan'
;
const
ACTIONKEY
=
'plan-changes'
;
protected
function
getRevisionActionLabel
()
{
return
pht
(
'Plan Changes'
);
}
protected
function
getRevisionActionDescription
(
DifferentialRevision
$revision
)
{
return
pht
(
'This revision will be removed from review queues until it is revised.'
);
}
public
function
getIcon
()
{
return
'fa-headphones'
;
}
public
function
getColor
()
{
return
'red'
;
}
protected
function
getRevisionActionOrder
()
{
return
200
;
}
public
function
getActionName
()
{
return
pht
(
'Planned Changes'
);
}
public
function
getCommandKeyword
()
{
return
'planchanges'
;
}
public
function
getCommandAliases
()
{
return
array
(
'rethink'
,
);
}
public
function
getCommandSummary
()
{
return
pht
(
'Plan changes to a revision.'
);
}
public
function
generateOldValue
(
$object
)
{
return
$object
->
isChangePlanned
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$status_planned
=
DifferentialRevisionStatus
::
CHANGES_PLANNED
;
$object
->
setModernRevisionStatus
(
$status_planned
);
}
protected
function
validateAction
(
$object
,
PhabricatorUser
$viewer
)
{
if
(
$object
->
isDraft
())
{
throw
new
Exception
(
pht
(
'You can not plan changes to a draft revision.'
));
}
if
(
$object
->
isChangePlanned
())
{
throw
new
Exception
(
pht
(
'You can not request review of this revision because this '
.
'revision is already under review and the action would have '
.
'no effect.'
));
}
if
(
$object
->
isClosed
())
{
throw
new
Exception
(
pht
(
'You can not plan changes to this this revision because it has '
.
'already been closed.'
));
}
if
(!
$this
->
isViewerRevisionAuthor
(
$object
,
$viewer
))
{
throw
new
Exception
(
pht
(
'You can not plan changes to this revision because you do not '
.
'own it. Only the author of a revision can plan changes to it.'
));
}
}
public
function
getTitle
()
{
return
pht
(
'%s planned changes to this revision.'
,
$this
->
renderAuthor
());
}
public
function
getTitleForFeed
()
{
return
pht
(
'%s planned changes to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
}
Event Timeline
Log In to Comment