Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93831191
DifferentialRevisionFulltextEngine.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
Sun, Dec 1, 20:51
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Dec 3, 20:51 (2 d)
Engine
blob
Format
Raw Data
Handle
22711905
Attached To
rPH Phabricator
DifferentialRevisionFulltextEngine.php
View Options
<?php
final
class
DifferentialRevisionFulltextEngine
extends
PhabricatorFulltextEngine
{
protected
function
buildAbstractDocument
(
PhabricatorSearchAbstractDocument
$document
,
$object
)
{
$revision
=
id
(
new
DifferentialRevisionQuery
())
->
setViewer
(
$this
->
getViewer
())
->
withPHIDs
(
array
(
$object
->
getPHID
()))
->
needReviewers
(
true
)
->
executeOne
();
// TODO: This isn't very clean, but custom fields currently rely on it.
$object
->
attachReviewers
(
$revision
->
getReviewers
());
$document
->
setDocumentTitle
(
$revision
->
getTitle
());
$document
->
addRelationship
(
PhabricatorSearchRelationship
::
RELATIONSHIP_AUTHOR
,
$revision
->
getAuthorPHID
(),
PhabricatorPeopleUserPHIDType
::
TYPECONST
,
$revision
->
getDateCreated
());
$document
->
addRelationship
(
$revision
->
isClosed
()
?
PhabricatorSearchRelationship
::
RELATIONSHIP_CLOSED
:
PhabricatorSearchRelationship
::
RELATIONSHIP_OPEN
,
$revision
->
getPHID
(),
DifferentialRevisionPHIDType
::
TYPECONST
,
PhabricatorTime
::
getNow
());
// If a revision needs review, the owners are the reviewers. Otherwise, the
// owner is the author (e.g., accepted, rejected, closed).
$status_review
=
ArcanistDifferentialRevisionStatus
::
NEEDS_REVIEW
;
if
(
$revision
->
getStatus
()
==
$status_review
)
{
$reviewers
=
$revision
->
getReviewerPHIDs
();
$reviewers
=
array_fuse
(
$reviewers
);
if
(
$reviewers
)
{
foreach
(
$reviewers
as
$phid
)
{
$document
->
addRelationship
(
PhabricatorSearchRelationship
::
RELATIONSHIP_OWNER
,
$phid
,
PhabricatorPeopleUserPHIDType
::
TYPECONST
,
$revision
->
getDateModified
());
// Bogus timestamp.
}
}
else
{
$document
->
addRelationship
(
PhabricatorSearchRelationship
::
RELATIONSHIP_UNOWNED
,
$revision
->
getPHID
(),
PhabricatorPeopleUserPHIDType
::
TYPECONST
,
$revision
->
getDateModified
());
// Bogus timestamp.
}
}
else
{
$document
->
addRelationship
(
PhabricatorSearchRelationship
::
RELATIONSHIP_OWNER
,
$revision
->
getAuthorPHID
(),
PhabricatorPHIDConstants
::
PHID_TYPE_VOID
,
$revision
->
getDateCreated
());
}
}
}
Event Timeline
Log In to Comment