Make home page much closer to the upstream
Mainly get rid of hardcoded feed panel, this can be done with dashboards now.
This commit is contained in:
		| @@ -33,6 +33,10 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|         ->setViewer($user) |         ->setViewer($user) | ||||||
|         ->setDashboard($dashboard) |         ->setDashboard($dashboard) | ||||||
|         ->renderDashboard(); |         ->renderDashboard(); | ||||||
|  |         if (PhabricatorEnv::getEnvConfig('welcome.file') !== null) { | ||||||
|  |           $content = array($this->buildWelcomePanelFromFile(), | ||||||
|  |                            $content); | ||||||
|  |         } | ||||||
|     } else { |     } else { | ||||||
|       $project_query = new PhabricatorProjectQuery(); |       $project_query = new PhabricatorProjectQuery(); | ||||||
|       $project_query->setViewer($user); |       $project_query->setViewer($user); | ||||||
| @@ -108,8 +112,6 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|       $revision_panel = null; |       $revision_panel = null; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     $feed_panel = $this->buildFeedPanel(); |  | ||||||
|  |  | ||||||
|     require_celerity_resource('homepage-panel-css'); |     require_celerity_resource('homepage-panel-css'); | ||||||
|     $home = phutil_tag( |     $home = phutil_tag( | ||||||
|       'div', |       'div', | ||||||
| @@ -125,7 +127,6 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|         $audit_panel, |         $audit_panel, | ||||||
|         $commit_panel, |         $commit_panel, | ||||||
|         $this->minipanels, |         $this->minipanels, | ||||||
|         $feed_panel, |  | ||||||
|       )); |       )); | ||||||
|       return $home; |       return $home; | ||||||
|   } |   } | ||||||
| @@ -138,10 +139,6 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     $user = $this->getRequest()->getUser(); |     $user = $this->getRequest()->getUser(); | ||||||
|     if (!$user->isLoggedIn()) { |  | ||||||
|       return null; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     $task_query = id(new ManiphestTaskQuery()) |     $task_query = id(new ManiphestTaskQuery()) | ||||||
|       ->setViewer($user) |       ->setViewer($user) | ||||||
| @@ -220,10 +217,6 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|  |  | ||||||
|   private function buildRevisionPanel() { |   private function buildRevisionPanel() { | ||||||
|     $user = $this->getRequest()->getUser(); |     $user = $this->getRequest()->getUser(); | ||||||
|     if (!$user->isLoggedIn()) { |  | ||||||
|       return null; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     $user_phid = $user->getPHID(); |     $user_phid = $user->getPHID(); | ||||||
|  |  | ||||||
|     $revision_query = id(new DifferentialRevisionQuery()) |     $revision_query = id(new DifferentialRevisionQuery()) | ||||||
| @@ -295,10 +288,6 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|  |  | ||||||
|   private function buildTasksPanel() { |   private function buildTasksPanel() { | ||||||
|     $user = $this->getRequest()->getUser(); |     $user = $this->getRequest()->getUser(); | ||||||
|     if (!$user->isLoggedIn()) { |  | ||||||
|       return null; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     $user_phid = $user->getPHID(); |     $user_phid = $user->getPHID(); | ||||||
|  |  | ||||||
|     $task_query = id(new ManiphestTaskQuery()) |     $task_query = id(new ManiphestTaskQuery()) | ||||||
| @@ -332,7 +321,6 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|     $user = $this->getRequest()->getUser(); |     $user = $this->getRequest()->getUser(); | ||||||
|  |  | ||||||
|     $phids = array_merge( |     $phids = array_merge( | ||||||
|       array_filter(mpull($tasks, 'getAuthorPHID')), |  | ||||||
|       array_filter(mpull($tasks, 'getOwnerPHID')), |       array_filter(mpull($tasks, 'getOwnerPHID')), | ||||||
|       array_mergev(mpull($tasks, 'getProjectPHIDs'))); |       array_mergev(mpull($tasks, 'getProjectPHIDs'))); | ||||||
|  |  | ||||||
| @@ -359,8 +347,8 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   private function renderMiniPanel($title, $body) { |   private function renderMiniPanel($title, $body) { | ||||||
|     $panel = new PHUIErrorView(); |     $panel = new PHUIInfoView(); | ||||||
|     $panel->setSeverity(PHUIErrorView::SEVERITY_NODATA); |     $panel->setSeverity(PHUIInfoView::SEVERITY_NODATA); | ||||||
|     $panel->appendChild( |     $panel->appendChild( | ||||||
|       phutil_tag( |       phutil_tag( | ||||||
|         'p', |         'p', | ||||||
| @@ -376,9 +364,6 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|   public function buildAuditPanel() { |   public function buildAuditPanel() { | ||||||
|     $request = $this->getRequest(); |     $request = $this->getRequest(); | ||||||
|     $user = $request->getUser(); |     $user = $request->getUser(); | ||||||
|     if (!$user->isLoggedIn()) { |  | ||||||
|       return null; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     $phids = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user); |     $phids = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user); | ||||||
|  |  | ||||||
| @@ -419,9 +404,6 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|   public function buildCommitPanel() { |   public function buildCommitPanel() { | ||||||
|     $request = $this->getRequest(); |     $request = $this->getRequest(); | ||||||
|     $user = $request->getUser(); |     $user = $request->getUser(); | ||||||
|     if (!$user->isLoggedIn()) { |  | ||||||
|       return null; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     $phids = array($user->getPHID()); |     $phids = array($user->getPHID()); | ||||||
|  |  | ||||||
| @@ -458,31 +440,4 @@ final class PhabricatorHomeMainController extends PhabricatorHomeController { | |||||||
|     return $panel; |     return $panel; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   public function buildFeedPanel() { |  | ||||||
|     $request = $this->getRequest(); |  | ||||||
|     $user = $request->getUser(); |  | ||||||
|     if ($user->isLoggedIn()) { |  | ||||||
|       return null; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     $viewer = PhabricatorUser::getOmnipotentUser(); |  | ||||||
|  |  | ||||||
|     $query = new PhabricatorFeedQuery(); |  | ||||||
|     $query->setViewer($viewer); |  | ||||||
|     $query->setLimit(25); |  | ||||||
|     $stories = $query->execute(); |  | ||||||
|  |  | ||||||
|     $builder = new PhabricatorFeedBuilder($stories); |  | ||||||
|     $builder |  | ||||||
|       ->setFramed(true) |  | ||||||
|       ->setUser($viewer); |  | ||||||
|  |  | ||||||
|     $panel = new AphrontPanelView(); |  | ||||||
|     $panel->setHeader('Activity Feed'); |  | ||||||
|     $panel->setNoBackground(); |  | ||||||
|     $panel->appendChild($builder->buildView()); |  | ||||||
|  |  | ||||||
|     return $panel; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user