Page MenuHomePhabricator
Paste P836

ExampleReviewerListener.php
ActivePublic

Authored by epriestley on May 16 2013, 7:01 PM.
Tags
None
Referenced Files
F43526: ExampleReviewerListener.php
Feb 24 2016, 1:31 AM
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