Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1148480
DifferentialRevisionVoidTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
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
,
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jul 1, 2:44 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
285682
Default Alt Text
DifferentialRevisionVoidTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment