1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Filter PhameHome on active blogs only

Summary: Fixes T9928. Not sure if this is best mechanic or add new methods to PhamePostQuery (a join?)

Test Plan: Archive a blog, don't see posts on PhameHome

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9928

Differential Revision: https://secure.phabricator.com/D14701
This commit is contained in:
Chad Little 2015-12-07 19:24:12 -08:00
parent 82e67e6bb9
commit 4973c2357c

View file

@ -9,20 +9,28 @@ final class PhameHomeController extends PhamePostController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$blogs = id(new PhameBlogQuery())
->setViewer($viewer)
->withStatuses(array(PhameBlog::STATUS_ACTIVE))
->execute();
$blog_phids = mpull($blogs, 'getPHID');
$pager = id(new AphrontCursorPagerView())
->readFromRequest($request);
$posts = id(new PhamePostQuery())
->setViewer($viewer)
->withBlogPHIDs($blog_phids)
->withVisibility(PhameConstants::VISIBILITY_PUBLISHED)
->executeWithCursorPager($pager);
$actions = $this->renderActions($viewer);
$action_button = id(new PHUIButtonView())
->setTag('a')
->setText(pht('Search'))
->setText(pht('Actions'))
->setHref('#')
->setIconFont('fa-search')
->setIconFont('fa-bars')
->addClass('phui-mobile-menu')
->setDropdownMenu($actions);
@ -63,17 +71,23 @@ final class PhameHomeController extends PhamePostController {
$actions = id(new PhabricatorActionListView())
->setUser($viewer);
$actions->addAction(
id(new PhabricatorActionView())
->setIcon('fa-pencil')
->setHref($this->getApplicationURI('post/query/draft/'))
->setName(pht('My Drafts')));
$actions->addAction(
id(new PhabricatorActionView())
->setIcon('fa-pencil-square-o')
->setHref($this->getApplicationURI('post/'))
->setName(pht('Find Posts')));
->setName(pht('All Posts')));
$actions->addAction(
id(new PhabricatorActionView())
->setIcon('fa-star')
->setHref($this->getApplicationURI('blog/'))
->setName(pht('Find Blogs')));
->setName(pht('Active Blogs')));
return $actions;
}