Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93548320
PhabricatorDiffInlineCommentQuery.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 29, 15:43
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 15:43 (2 d)
Engine
blob
Format
Raw Data
Handle
22661310
Attached To
rPH Phabricator
PhabricatorDiffInlineCommentQuery.php
View Options
<?php
abstract
class
PhabricatorDiffInlineCommentQuery
extends
PhabricatorApplicationTransactionCommentQuery
{
private
$fixedStates
;
private
$needReplyToComments
;
public
function
withFixedStates
(
array
$states
)
{
$this
->
fixedStates
=
$states
;
return
$this
;
}
public
function
needReplyToComments
(
$need_reply_to
)
{
$this
->
needReplyToComments
=
$need_reply_to
;
return
$this
;
}
protected
function
buildWhereClauseComponents
(
AphrontDatabaseConnection
$conn_r
)
{
$where
=
parent
::
buildWhereClauseComponents
(
$conn_r
);
if
(
$this
->
fixedStates
!==
null
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'fixedState IN (%Ls)'
,
$this
->
fixedStates
);
}
return
$where
;
}
protected
function
willFilterPage
(
array
$comments
)
{
if
(
$this
->
needReplyToComments
)
{
$reply_phids
=
array
();
foreach
(
$comments
as
$comment
)
{
$reply_phid
=
$comment
->
getReplyToCommentPHID
();
if
(
$reply_phid
)
{
$reply_phids
[]
=
$reply_phid
;
}
}
if
(
$reply_phids
)
{
$reply_comments
=
newv
(
get_class
(
$this
),
array
())
->
setViewer
(
$this
->
getViewer
())
->
setParentQuery
(
$this
)
->
withPHIDs
(
$reply_phids
)
->
execute
();
$reply_comments
=
mpull
(
$reply_comments
,
null
,
'getPHID'
);
}
else
{
$reply_comments
=
array
();
}
foreach
(
$comments
as
$key
=>
$comment
)
{
$reply_phid
=
$comment
->
getReplyToCommentPHID
();
if
(!
$reply_phid
)
{
$comment
->
attachReplyToComment
(
null
);
continue
;
}
$reply
=
idx
(
$reply_comments
,
$reply_phid
);
if
(!
$reply
)
{
$this
->
didRejectResult
(
$comment
);
unset
(
$comments
[
$key
]);
continue
;
}
$comment
->
attachReplyToComment
(
$reply
);
}
}
return
$comments
;
}
}
Event Timeline
Log In to Comment