Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F573375
DifferentialGetRevisionCommentsConduitAPIMethod.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
DifferentialGetRevisionCommentsConduitAPIMethod.php
View Options
<?php
final
class
DifferentialGetRevisionCommentsConduitAPIMethod
extends
DifferentialConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'differential.getrevisioncomments'
;
}
public
function
getMethodStatus
()
{
return
self
::
METHOD_STATUS_DEPRECATED
;
}
public
function
getMethodStatusDescription
()
{
return
pht
(
'Obsolete and doomed, see T2222.'
);
}
public
function
getMethodDescription
()
{
return
pht
(
'Retrieve Differential Revision Comments.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'ids'
=>
'required list<int>'
,
'inlines'
=>
'optional bool (deprecated)'
,
);
}
protected
function
defineReturnType
()
{
return
'nonempty list<dict<string, wild>>'
;
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$viewer
=
$request
->
getUser
();
$results
=
array
();
$revision_ids
=
$request
->
getValue
(
'ids'
);
if
(!
$revision_ids
)
{
return
$results
;
}
$revisions
=
id
(
new
DifferentialRevisionQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
$revision_ids
)
->
execute
();
if
(!
$revisions
)
{
return
$results
;
}
$xactions
=
id
(
new
DifferentialTransactionQuery
())
->
setViewer
(
$viewer
)
->
withObjectPHIDs
(
mpull
(
$revisions
,
'getPHID'
))
->
execute
();
$revisions
=
mpull
(
$revisions
,
null
,
'getPHID'
);
foreach
(
$xactions
as
$xaction
)
{
$revision
=
idx
(
$revisions
,
$xaction
->
getObjectPHID
());
if
(!
$revision
)
{
continue
;
}
$type
=
$xaction
->
getTransactionType
();
if
(
$type
==
DifferentialTransaction
::
TYPE_ACTION
)
{
$action
=
$xaction
->
getNewValue
();
}
else
if
(
$type
==
PhabricatorTransactions
::
TYPE_COMMENT
)
{
$action
=
'comment'
;
}
else
{
$action
=
'none'
;
}
$result
=
array
(
'revisionID'
=>
$revision
->
getID
(),
'action'
=>
$action
,
'authorPHID'
=>
$xaction
->
getAuthorPHID
(),
'dateCreated'
=>
$xaction
->
getDateCreated
(),
'content'
=>
(
$xaction
->
hasComment
()
?
$xaction
->
getComment
()->
getContent
()
:
null
),
);
$results
[
$revision
->
getID
()][]
=
$result
;
}
return
$results
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 13, 5:53 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
97389
Default Alt Text
DifferentialGetRevisionCommentsConduitAPIMethod.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment