forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhabricatorSubscriptionsListController.php
46 lines (35 loc) · 1.13 KB
/
PhabricatorSubscriptionsListController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
final class PhabricatorSubscriptionsListController
extends PhabricatorController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$object = id(new PhabricatorObjectQuery())
->setViewer($viewer)
->withPHIDs(array($request->getURIData('phid')))
->executeOne();
if (!$object) {
return new Aphront404Response();
}
if (!($object instanceof PhabricatorSubscribableInterface)) {
return new Aphront404Response();
}
$phid = $object->getPHID();
$handle_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID($phid);
$handle_phids[] = $phid;
$handles = id(new PhabricatorHandleQuery())
->setViewer($viewer)
->withPHIDs($handle_phids)
->execute();
$object_handle = $handles[$phid];
$dialog = id(new SubscriptionListDialogBuilder())
->setViewer($viewer)
->setTitle(pht('Subscribers'))
->setObjectPHID($phid)
->setHandles($handles)
->buildDialog();
return id(new AphrontDialogResponse())->setDialog($dialog);
}
}