<?php

final class PhabricatorSubscriptionsListController
  extends PhabricatorController {

  private $phid;

  public function willProcessRequest(array $data) {
    $this->phid = idx($data, 'phid');
  }

  public function processRequest() {
    $request = $this->getRequest();

    $viewer = $request->getUser();
    $phid = $this->phid;

    $object = id(new PhabricatorObjectQuery())
      ->setViewer($viewer)
      ->withPHIDs(array($phid))
      ->executeOne();

    if ($object instanceof PhabricatorSubscribableInterface) {
      $subscriber_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
        $phid);
    }

    $handle_phids = $subscriber_phids;
    $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);
  }

}

<?php

final class PhabricatorSubscriptionsListController
  extends PhabricatorController {

  private $phid;

  public function willProcessRequest(array $data) {
    $this->phid = idx($data, 'phid');
  }

  public function shouldAllowPublic() {
    return true;
  }

  public function processRequest() {
    $request = $this->getRequest();

    $viewer = $request->getUser();
    $phid = $this->phid;

    $object = id(new PhabricatorObjectQuery())
      ->setViewer($viewer)
      ->withPHIDs(array($phid))
      ->executeOne();

    if ($object instanceof PhabricatorSubscribableInterface) {
      $subscriber_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
        $phid);
    }

    $handle_phids = $subscriber_phids;
    $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);
  }

}

Allow public on list of subscribers
Allow public on list of subscribers

Summary: Fixes T7317, allows public to be set on this list controller.

Test Plan: Tested a list of subscribers on a logged in and logged out Diff.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7317

Differential Revision: https://secure.phabricator.com/D11801
