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

On Dashboards, distinguish between invalid panels and restricted panels

Summary:
Depends on D20374. Panels may not be visible if they are restricted (no permission) or if they are invalid (e.g., the panel was deleted).

Render these as two separate states instead of one big combined state.

Test Plan: {F6334756}

Reviewers: amckinley

Reviewed By: amckinley

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

+35 -7
+25 -6
src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php
··· 14 14 private $headerMode = self::HEADER_MODE_NORMAL; 15 15 private $dashboardID; 16 16 private $movable = true; 17 + private $panelHandle; 17 18 18 19 public function setDashboardID($id) { 19 20 $this->dashboardID = $id; ··· 31 32 32 33 public function getHeaderMode() { 33 34 return $this->headerMode; 35 + } 36 + 37 + public function setPanelHandle(PhabricatorObjectHandle $panel_handle) { 38 + $this->panelHandle = $panel_handle; 39 + return $this; 40 + } 41 + 42 + public function getPanelHandle() { 43 + return $this->panelHandle; 34 44 } 35 45 36 46 /** ··· 90 100 $panel = $this->getPanel(); 91 101 92 102 if (!$panel) { 93 - return $this->renderErrorPanel( 94 - pht('Missing or Restricted Panel'), 95 - pht( 96 - 'This panel does not exist, or you do not have permission '. 97 - 'to see it.')); 103 + $handle = $this->getPanelHandle(); 104 + if ($handle->getPolicyFiltered()) { 105 + return $this->renderErrorPanel( 106 + pht('Restricted Panel'), 107 + pht( 108 + 'You do not have permission to see this panel.')); 109 + } else { 110 + return $this->renderErrorPanel( 111 + pht('Invalid Panel'), 112 + pht( 113 + 'This panel is invalid or does not exist. It may have been '. 114 + 'deleted.')); 115 + } 98 116 } 99 117 100 118 $panel_type = $panel->getImplementation(); ··· 185 203 ->setHeader($title); 186 204 break; 187 205 } 206 + 188 207 $icon = id(new PHUIIconView()) 189 208 ->setIcon('fa-warning red msr'); 190 209 191 210 $content = id(new PHUIBoxView()) 192 211 ->addClass('dashboard-box') 193 - ->addMargin(PHUI::MARGIN_MEDIUM) 212 + ->addMargin(PHUI::MARGIN_LARGE) 194 213 ->appendChild($icon) 195 214 ->appendChild($body); 196 215
+10 -1
src/applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php
··· 41 41 $h_mode = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_NORMAL; 42 42 } 43 43 44 + $panel_phids = array(); 45 + foreach ($panel_grid_locations as $panel_column_locations) { 46 + foreach ($panel_column_locations as $panel_phid) { 47 + $panel_phids[] = $panel_phid; 48 + } 49 + } 50 + $handles = $viewer->loadHandles($panel_phids); 51 + 44 52 foreach ($panel_grid_locations as $column => $panel_column_locations) { 45 53 $panel_phids = $panel_column_locations; 46 54 ··· 57 65 ->setEnableAsyncRendering(true) 58 66 ->setPanelPHID($panel_phid) 59 67 ->setParentPanelPHIDs(array()) 60 - ->setHeaderMode($h_mode); 68 + ->setHeaderMode($h_mode) 69 + ->setPanelHandle($handles[$panel_phid]); 61 70 62 71 $panel = idx($panels, $panel_phid); 63 72 if ($panel) {