Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93029776
DiffusionCommitAcceptTransaction.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, Nov 25, 16:31
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 16:31 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22557299
Attached To
rPH Phabricator
DiffusionCommitAcceptTransaction.php
View Options
<?php
final
class
DiffusionCommitAcceptTransaction
extends
DiffusionCommitAuditTransaction
{
const
TRANSACTIONTYPE
=
'diffusion.commit.accept'
;
const
ACTIONKEY
=
'accept'
;
protected
function
getCommitActionLabel
()
{
return
pht
(
"Accept Commit
\x
E2
\x
9C
\x
94"
);
}
protected
function
getCommitActionDescription
()
{
return
pht
(
'This commit will be approved.'
);
}
public
function
getIcon
()
{
return
'fa-check-circle-o'
;
}
public
function
getColor
()
{
return
'green'
;
}
protected
function
getCommitActionOrder
()
{
return
500
;
}
public
function
getActionName
()
{
return
pht
(
'Accepted'
);
}
public
function
applyExternalEffects
(
$object
,
$value
)
{
$status
=
PhabricatorAuditStatusConstants
::
ACCEPTED
;
$actor
=
$this
->
getActor
();
$this
->
applyAuditorEffect
(
$object
,
$actor
,
$value
,
$status
);
}
protected
function
validateAction
(
$object
,
PhabricatorUser
$viewer
)
{
$config_key
=
'audit.can-author-close-audit'
;
if
(!
PhabricatorEnv
::
getEnvConfig
(
$config_key
))
{
if
(
$this
->
isViewerCommitAuthor
(
$object
,
$viewer
))
{
throw
new
Exception
(
pht
(
'You can not accept this commit because you are the commit '
.
'author. You can only accept commits you did not author. 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 commit because you have already '
.
'accepted it.'
));
}
}
public
function
getTitle
()
{
return
pht
(
'%s accepted this commit.'
,
$this
->
renderAuthor
());
}
public
function
getTitleForFeed
()
{
return
pht
(
'%s accepted %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
}
Event Timeline
Log In to Comment