Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F109991886
ConduitAPI_differential_getrevisionfeedback_Method.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
Thu, Apr 24, 06:44
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Apr 26, 06:44 (2 d)
Engine
blob
Format
Raw Data
Handle
25770063
Attached To
rPH Phabricator
ConduitAPI_differential_getrevisionfeedback_Method.php
View Options
<?php
/**
* @group conduit
*/
final
class
ConduitAPI_differential_getrevisionfeedback_Method
extends
ConduitAPIMethod
{
public
function
getMethodStatus
()
{
return
self
::
METHOD_STATUS_DEPRECATED
;
}
public
function
getMethodStatusDescription
()
{
return
"Replaced by 'differential.getrevisioncomments'."
;
}
public
function
getMethodDescription
()
{
return
"Retrieve Differential Revision Feedback."
;
}
public
function
defineParamTypes
()
{
return
array
(
'ids'
=>
'required list<int>'
,
);
}
public
function
defineReturnType
()
{
return
'nonempty list<dict<string, wild>>'
;
}
public
function
defineErrorTypes
()
{
return
array
(
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$results
=
array
();
$revision_ids
=
$request
->
getValue
(
'ids'
);
if
(!
$revision_ids
)
{
return
$results
;
}
$comments
=
id
(
new
DifferentialComment
())->
loadAllWhere
(
'revisionID IN (%Ld)'
,
$revision_ids
);
// Helper dictionary to keep track of where the id/action pair is
// stored in results array.
$indexes
=
array
();
foreach
(
$comments
as
$comment
)
{
$action
=
$comment
->
getAction
();
$revision_id
=
$comment
->
getRevisionID
();
if
(
isset
(
$indexes
[
$action
.
$revision_id
]))
{
$results
[
$indexes
[
$action
.
$revision_id
]][
'count'
]++;
}
else
{
$indexes
[
$action
.
$revision_id
]
=
count
(
$results
);
$results
[]
=
array
(
'id'
=>
$revision_id
,
'action'
=>
$action
,
'count'
=>
1
);
}
}
return
$results
;
}
}
Event Timeline
Log In to Comment