Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F438306
DifferentialRevisionAcceptTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
DifferentialRevisionAcceptTransaction.php
View Options
<?php
final
class
DifferentialRevisionAcceptTransaction
extends
DifferentialRevisionReviewTransaction
{
const
TRANSACTIONTYPE
=
'differential.revision.accept'
;
const
ACTIONKEY
=
'accept'
;
protected
function
getRevisionActionLabel
()
{
return
pht
(
"Accept Revision
\x
E2
\x
9C
\x
94"
);
}
protected
function
getRevisionActionDescription
()
{
return
pht
(
'These changes will be approved.'
);
}
public
function
getIcon
()
{
return
'fa-check-circle-o'
;
}
public
function
getColor
()
{
return
'green'
;
}
protected
function
getRevisionActionOrder
()
{
return
500
;
}
public
function
getActionName
()
{
return
pht
(
'Accepted'
);
}
public
function
getCommandKeyword
()
{
$accept_key
=
'differential.enable-email-accept'
;
$allow_email_accept
=
PhabricatorEnv
::
getEnvConfig
(
$accept_key
);
if
(!
$allow_email_accept
)
{
return
null
;
}
return
'accept'
;
}
public
function
getCommandAliases
()
{
return
array
();
}
public
function
getCommandSummary
()
{
return
pht
(
'Accept a revision.'
);
}
public
function
generateOldValue
(
$object
)
{
$actor
=
$this
->
getActor
();
return
$this
->
isViewerFullyAccepted
(
$object
,
$actor
);
}
public
function
applyExternalEffects
(
$object
,
$value
)
{
$status
=
DifferentialReviewerStatus
::
STATUS_ACCEPTED
;
$actor
=
$this
->
getActor
();
$this
->
applyReviewerEffect
(
$object
,
$actor
,
$value
,
$status
);
}
protected
function
validateAction
(
$object
,
PhabricatorUser
$viewer
)
{
if
(
$object
->
isClosed
())
{
throw
new
Exception
(
pht
(
'You can not accept this revision because it has already been '
.
'closed. Only open revisions can be accepted.'
));
}
$config_key
=
'differential.allow-self-accept'
;
if
(!
PhabricatorEnv
::
getEnvConfig
(
$config_key
))
{
if
(
$this
->
isViewerRevisionAuthor
(
$object
,
$viewer
))
{
throw
new
Exception
(
pht
(
'You can not accept this revision because you are the revision '
.
'author. You can only accept revisions you do not own. You can '
.
'change this behavior by adjusting the "%s" setting in Config.'
,
$config_key
));
}
}
if
(
$this
->
isViewerFullyAccepted
(
$object
,
$viewer
))
{
throw
new
Exception
(
pht
(
'You can not accept this revision because you have already '
.
'accepted it.'
));
}
}
public
function
getTitle
()
{
return
pht
(
'%s accepted this revision.'
,
$this
->
renderAuthor
());
}
public
function
getTitleForFeed
()
{
return
pht
(
'%s accepted %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 2:21 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
63025
Default Alt Text
DifferentialRevisionAcceptTransaction.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment