@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 136 lines 3.8 kB view raw
1<?php 2 3final class PhabricatorSpacesViewController 4 extends PhabricatorSpacesController { 5 6 public function shouldAllowPublic() { 7 return true; 8 } 9 10 public function handleRequest(AphrontRequest $request) { 11 $viewer = $this->getViewer(); 12 13 $space = id(new PhabricatorSpacesNamespaceQuery()) 14 ->setViewer($viewer) 15 ->withIDs(array($request->getURIData('id'))) 16 ->executeOne(); 17 if (!$space) { 18 return new Aphront404Response(); 19 } 20 21 $curtain = $this->buildCurtain($space); 22 $property_list = $this->buildPropertyListView($space); 23 $title = array($space->getMonogram(), $space->getNamespaceName()); 24 25 $xactions = id(new PhabricatorSpacesNamespaceTransactionQuery()) 26 ->setViewer($viewer) 27 ->withObjectPHIDs(array($space->getPHID())) 28 ->execute(); 29 30 $timeline = $this->buildTransactionTimeline( 31 $space, 32 new PhabricatorSpacesNamespaceTransactionQuery()); 33 $timeline->setShouldTerminate(true); 34 35 $header = id(new PHUIHeaderView()) 36 ->setViewer($viewer) 37 ->setHeader($space->getNamespaceName()) 38 ->setPolicyObject($space) 39 ->setHeaderIcon('fa-th-large'); 40 41 if ($space->getIsArchived()) { 42 $header->setStatus('fa-ban', 'indigo', pht('Archived')); 43 } else { 44 $header->setStatus('fa-check', 'bluegrey', pht('Active')); 45 } 46 47 $box = id(new PHUIObjectBoxView()) 48 ->setHeaderText(pht('Details')) 49 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 50 ->addPropertyList($property_list); 51 52 $crumbs = $this->buildApplicationCrumbs(); 53 $crumbs->addTextCrumb($space->getMonogram()); 54 $crumbs->setBorder(true); 55 56 $view = id(new PHUITwoColumnView()) 57 ->setHeader($header) 58 ->setMainColumn(array( 59 $box, 60 $timeline, 61 )) 62 ->setCurtain($curtain); 63 64 return $this->newPage() 65 ->setTitle($title) 66 ->setCrumbs($crumbs) 67 ->appendChild($view); 68 69 } 70 71 private function buildPropertyListView(PhabricatorSpacesNamespace $space) { 72 $viewer = $this->getRequest()->getUser(); 73 74 $list = id(new PHUIPropertyListView()) 75 ->setViewer($viewer); 76 77 $list->addProperty( 78 pht('Default Space'), 79 $space->getIsDefaultNamespace() 80 ? pht('Yes') 81 : pht('No')); 82 83 $description = $space->getDescription(); 84 if (strlen($description)) { 85 $description = new PHUIRemarkupView($viewer, $description); 86 $list->addSectionHeader( 87 pht('Description'), 88 PHUIPropertyListView::ICON_SUMMARY); 89 $list->addTextContent($description); 90 } 91 92 return $list; 93 } 94 95 private function buildCurtain(PhabricatorSpacesNamespace $space) { 96 $viewer = $this->getRequest()->getUser(); 97 98 $curtain = $this->newCurtainView($space); 99 100 $can_edit = PhabricatorPolicyFilter::hasCapability( 101 $viewer, 102 $space, 103 PhabricatorPolicyCapability::CAN_EDIT); 104 105 $curtain->addAction( 106 id(new PhabricatorActionView()) 107 ->setName(pht('Edit Space')) 108 ->setIcon('fa-pencil') 109 ->setHref($this->getApplicationURI('edit/'.$space->getID().'/')) 110 ->setWorkflow(!$can_edit) 111 ->setDisabled(!$can_edit)); 112 113 $id = $space->getID(); 114 115 if ($space->getIsArchived()) { 116 $curtain->addAction( 117 id(new PhabricatorActionView()) 118 ->setName(pht('Activate Space')) 119 ->setIcon('fa-check') 120 ->setHref($this->getApplicationURI("activate/{$id}/")) 121 ->setDisabled(!$can_edit) 122 ->setWorkflow(true)); 123 } else { 124 $curtain->addAction( 125 id(new PhabricatorActionView()) 126 ->setName(pht('Archive Space')) 127 ->setIcon('fa-ban') 128 ->setHref($this->getApplicationURI("archive/{$id}/")) 129 ->setDisabled(!$can_edit) 130 ->setWorkflow(true)); 131 } 132 133 return $curtain; 134 } 135 136}