3 final class PhabricatorSubscriptionsTransactionController
4 extends PhabricatorController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $request->getViewer();
8 $phid = $request->getURIData('phid');
9 $type = $request->getURIData('type');
11 $xaction = id(new PhabricatorObjectQuery())
12 ->withPHIDs(array($phid))
16 return new Aphront404Response();
19 $old = $xaction->getOldValue();
20 $new = $xaction->getNewValue();
23 $subscriber_phids = array_diff($new, $old);
26 $subscriber_phids = array_diff($old, $new);
29 return id(new Aphront404Response());
32 $object_phid = $xaction->getObjectPHID();
33 $author_phid = $xaction->getAuthorPHID();
34 $handle_phids = $subscriber_phids;
35 $handle_phids[] = $object_phid;
36 $handle_phids[] = $author_phid;
38 $handles = id(new PhabricatorHandleQuery())
40 ->withPHIDs($handle_phids)
42 $author_handle = $handles[$author_phid];
43 if (!in_array($author_phid, $subscriber_phids)) {
44 unset($handles[$author_phid]);
50 'All %d subscribers added by %s',
51 count($subscriber_phids),
52 $author_handle->renderLink());
56 'All %d subscribers removed by %s',
57 count($subscriber_phids),
58 $author_handle->renderLink());
62 $dialog = id(new SubscriptionListDialogBuilder())
65 ->setObjectPHID($object_phid)
66 ->setHandles($handles)
69 return id(new AphrontDialogResponse())->setDialog($dialog);