Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92696508
DifferentialRevisionVoidTransaction.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
Fri, Nov 22, 21:09
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 21:09 (2 d)
Engine
blob
Format
Raw Data
Handle
22488449
Attached To
rPH Phabricator
DifferentialRevisionVoidTransaction.php
View Options
<?php
/**
* This is an internal transaction type used to void reviews.
*
* For example, "Request Review" voids any open accepts, so they no longer
* act as current accepts.
*/
final
class
DifferentialRevisionVoidTransaction
extends
DifferentialRevisionTransactionType
{
const
TRANSACTIONTYPE
=
'differential.revision.void'
;
public
function
generateOldValue
(
$object
)
{
return
false
;
}
public
function
generateNewValue
(
$object
,
$value
)
{
$table
=
new
DifferentialReviewer
();
$table_name
=
$table
->
getTableName
();
$conn
=
$table
->
establishConnection
(
'w'
);
$rows
=
queryfx_all
(
$conn
,
'SELECT reviewerPHID FROM %T
WHERE revisionPHID = %s
AND voidedPHID IS NULL
AND reviewerStatus IN (%Ls)'
,
$table_name
,
$object
->
getPHID
(),
$value
);
return
ipull
(
$rows
,
'reviewerPHID'
);
}
public
function
getTransactionHasEffect
(
$object
,
$old
,
$new
)
{
return
(
bool
)
$new
;
}
public
function
applyExternalEffects
(
$object
,
$value
)
{
$table
=
new
DifferentialReviewer
();
$table_name
=
$table
->
getTableName
();
$conn
=
$table
->
establishConnection
(
'w'
);
queryfx
(
$conn
,
'UPDATE %T SET voidedPHID = %s
WHERE revisionPHID = %s
AND voidedPHID IS NULL
AND reviewerPHID IN (%Ls)'
,
$table_name
,
$this
->
getActingAsPHID
(),
$object
->
getPHID
(),
$value
);
}
public
function
shouldHide
()
{
// This is an internal transaction, so don't show it in feeds or
// transaction logs.
return
true
;
}
private
function
getVoidableStatuses
()
{
return
array
(
DifferentialReviewerStatus
::
STATUS_ACCEPTED
,
DifferentialReviewerStatus
::
STATUS_REJECTED
,
);
}
}
Event Timeline
Log In to Comment