Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P836
ExampleReviewerListener.php
Active
Public
Actions
Authored by
epriestley
on May 16 2013, 7:01 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Flag For Later
Award Token
Tags
None
Referenced Files
F43526: ExampleReviewerListener.php
Feb 24 2016, 1:31 AM
2016-02-24 01:31:53 (UTC+0)
Subscribers
None
<?php
final
class
ExampleReviewerListener
extends
PhutilEventListener
{
public
function
register
()
{
$this
->
listen
(
ArcanistEventType
::
TYPE_DIFF_WILLBUILDMESSAGE
);
}
public
function
handleEvent
(
PhutilEvent
$event
)
{
$fields
=
$event
->
getValue
(
'fields'
);
$more
=
$event
->
getValue
(
'workflow'
)->
getConduit
()->
callMethodSynchronous
(
'user.query'
,
array
(
'usernames'
=>
array
(
'dog'
,
'duck'
,
),
));
$phids
=
idx
(
$fields
,
'reviewerPHIDs'
,
array
());
foreach
(
$more
as
$user
)
{
$phids
[]
=
$user
[
'phid'
];
}
$phids
=
array_unique
(
$phids
);
$fields
[
'reviewerPHIDs'
]
=
$phids
;
$event
->
setValue
(
'fields'
,
$fields
);
}
}
Event Timeline
epriestley
edited the content of this paste.
(Show Details)
May 16 2013, 7:01 PM
2013-05-16 19:01:15 (UTC+0)
Log In to Comment