mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-21 19:19:12 +01: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:
parent
82e67e6bb9
commit
4973c2357c
1 changed files with 18 additions and 4 deletions
|
@ -9,20 +9,28 @@ final class PhameHomeController extends PhamePostController {
|
||||||
public function handleRequest(AphrontRequest $request) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$viewer = $request->getViewer();
|
$viewer = $request->getViewer();
|
||||||
|
|
||||||
|
$blogs = id(new PhameBlogQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withStatuses(array(PhameBlog::STATUS_ACTIVE))
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$blog_phids = mpull($blogs, 'getPHID');
|
||||||
|
|
||||||
$pager = id(new AphrontCursorPagerView())
|
$pager = id(new AphrontCursorPagerView())
|
||||||
->readFromRequest($request);
|
->readFromRequest($request);
|
||||||
|
|
||||||
$posts = id(new PhamePostQuery())
|
$posts = id(new PhamePostQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
|
->withBlogPHIDs($blog_phids)
|
||||||
->withVisibility(PhameConstants::VISIBILITY_PUBLISHED)
|
->withVisibility(PhameConstants::VISIBILITY_PUBLISHED)
|
||||||
->executeWithCursorPager($pager);
|
->executeWithCursorPager($pager);
|
||||||
|
|
||||||
$actions = $this->renderActions($viewer);
|
$actions = $this->renderActions($viewer);
|
||||||
$action_button = id(new PHUIButtonView())
|
$action_button = id(new PHUIButtonView())
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setText(pht('Search'))
|
->setText(pht('Actions'))
|
||||||
->setHref('#')
|
->setHref('#')
|
||||||
->setIconFont('fa-search')
|
->setIconFont('fa-bars')
|
||||||
->addClass('phui-mobile-menu')
|
->addClass('phui-mobile-menu')
|
||||||
->setDropdownMenu($actions);
|
->setDropdownMenu($actions);
|
||||||
|
|
||||||
|
@ -63,17 +71,23 @@ final class PhameHomeController extends PhamePostController {
|
||||||
$actions = id(new PhabricatorActionListView())
|
$actions = id(new PhabricatorActionListView())
|
||||||
->setUser($viewer);
|
->setUser($viewer);
|
||||||
|
|
||||||
|
$actions->addAction(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setIcon('fa-pencil')
|
||||||
|
->setHref($this->getApplicationURI('post/query/draft/'))
|
||||||
|
->setName(pht('My Drafts')));
|
||||||
|
|
||||||
$actions->addAction(
|
$actions->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setIcon('fa-pencil-square-o')
|
->setIcon('fa-pencil-square-o')
|
||||||
->setHref($this->getApplicationURI('post/'))
|
->setHref($this->getApplicationURI('post/'))
|
||||||
->setName(pht('Find Posts')));
|
->setName(pht('All Posts')));
|
||||||
|
|
||||||
$actions->addAction(
|
$actions->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setIcon('fa-star')
|
->setIcon('fa-star')
|
||||||
->setHref($this->getApplicationURI('blog/'))
|
->setHref($this->getApplicationURI('blog/'))
|
||||||
->setName(pht('Find Blogs')));
|
->setName(pht('Active Blogs')));
|
||||||
|
|
||||||
return $actions;
|
return $actions;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue