diff --git a/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php b/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php --- a/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php +++ b/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php @@ -14,6 +14,7 @@ private $headerMode = self::HEADER_MODE_NORMAL; private $dashboardID; private $movable = true; + private $panelHandle; public function setDashboardID($id) { $this->dashboardID = $id; @@ -33,6 +34,15 @@ return $this->headerMode; } + public function setPanelHandle(PhabricatorObjectHandle $panel_handle) { + $this->panelHandle = $panel_handle; + return $this; + } + + public function getPanelHandle() { + return $this->panelHandle; + } + /** * Allow the engine to render the panel via Ajax. */ @@ -90,11 +100,19 @@ $panel = $this->getPanel(); if (!$panel) { - return $this->renderErrorPanel( - pht('Missing or Restricted Panel'), - pht( - 'This panel does not exist, or you do not have permission '. - 'to see it.')); + $handle = $this->getPanelHandle(); + if ($handle->getPolicyFiltered()) { + return $this->renderErrorPanel( + pht('Restricted Panel'), + pht( + 'You do not have permission to see this panel.')); + } else { + return $this->renderErrorPanel( + pht('Invalid Panel'), + pht( + 'This panel is invalid or does not exist. It may have been '. + 'deleted.')); + } } $panel_type = $panel->getImplementation(); @@ -185,12 +203,13 @@ ->setHeader($title); break; } + $icon = id(new PHUIIconView()) ->setIcon('fa-warning red msr'); $content = id(new PHUIBoxView()) ->addClass('dashboard-box') - ->addMargin(PHUI::MARGIN_MEDIUM) + ->addMargin(PHUI::MARGIN_LARGE) ->appendChild($icon) ->appendChild($body); diff --git a/src/applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php b/src/applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php --- a/src/applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php +++ b/src/applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php @@ -41,6 +41,14 @@ $h_mode = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_NORMAL; } + $panel_phids = array(); + foreach ($panel_grid_locations as $panel_column_locations) { + foreach ($panel_column_locations as $panel_phid) { + $panel_phids[] = $panel_phid; + } + } + $handles = $viewer->loadHandles($panel_phids); + foreach ($panel_grid_locations as $column => $panel_column_locations) { $panel_phids = $panel_column_locations; @@ -57,7 +65,8 @@ ->setEnableAsyncRendering(true) ->setPanelPHID($panel_phid) ->setParentPanelPHIDs(array()) - ->setHeaderMode($h_mode); + ->setHeaderMode($h_mode) + ->setPanelHandle($handles[$panel_phid]); $panel = idx($panels, $panel_phid); if ($panel) {