@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhortuneAccountSubscriptionController
4 extends PhortuneAccountProfileController {
5
6 protected function shouldRequireAccountEditCapability() {
7 return false;
8 }
9
10 protected function handleAccountRequest(AphrontRequest $request) {
11 $account = $this->getAccount();
12 $title = $account->getName();
13
14 $crumbs = $this->buildApplicationCrumbs()
15 ->addTextCrumb(pht('Subscriptions'))
16 ->setBorder(true);
17
18 $header = $this->buildHeaderView();
19 $authority = $this->newAccountAuthorityView();
20
21 $subscriptions = $this->buildSubscriptionsSection($account);
22
23 $view = id(new PHUITwoColumnView())
24 ->setHeader($header)
25 ->setFooter(
26 array(
27 $authority,
28 $subscriptions,
29 ));
30
31 $navigation = $this->buildSideNavView('subscriptions');
32
33 return $this->newPage()
34 ->setTitle($title)
35 ->setCrumbs($crumbs)
36 ->setNavigation($navigation)
37 ->appendChild($view);
38
39 }
40
41 private function buildSubscriptionsSection(PhortuneAccount $account) {
42 $viewer = $this->getViewer();
43
44 $subscriptions = id(new PhortuneSubscriptionQuery())
45 ->setViewer($viewer)
46 ->withAccountPHIDs(array($account->getPHID()))
47 ->setLimit(25)
48 ->execute();
49
50 $table = id(new PhortuneSubscriptionTableView())
51 ->setUser($viewer)
52 ->setSubscriptions($subscriptions);
53
54 $header = id(new PHUIHeaderView())
55 ->setHeader(pht('Subscriptions'));
56
57 return id(new PHUIObjectBoxView())
58 ->setHeader($header)
59 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
60 ->setTable($table);
61 }
62
63}