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

Add some more consistant NUX to Phame

Summary: Adds a no visible blogs and no posts nux state using new UI. Ref T10032

Test Plan: Archived all my blogs, got no posts fallback. Test a New Blog, got create a post, logged out, saw no create button.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T10032

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

+58 -20
+29 -14
src/applications/phame/controller/PhameHomeController.php
··· 15 15 ->needProfileImage(true) 16 16 ->execute(); 17 17 18 - $blog_phids = mpull($blogs, 'getPHID'); 18 + $post_list = null; 19 + if ($blogs) { 20 + $blog_phids = mpull($blogs, 'getPHID'); 21 + 22 + $pager = id(new AphrontCursorPagerView()) 23 + ->readFromRequest($request); 19 24 20 - $pager = id(new AphrontCursorPagerView()) 21 - ->readFromRequest($request); 25 + $posts = id(new PhamePostQuery()) 26 + ->setViewer($viewer) 27 + ->withBlogPHIDs($blog_phids) 28 + ->withVisibility(PhameConstants::VISIBILITY_PUBLISHED) 29 + ->executeWithCursorPager($pager); 30 + 31 + $post_list = id(new PhamePostListView()) 32 + ->setPosts($posts) 33 + ->setViewer($viewer) 34 + ->showBlog(true); 35 + } else { 36 + $create_button = id(new PHUIButtonView()) 37 + ->setTag('a') 38 + ->setText(pht('Create a Blog')) 39 + ->setHref('/phame/blog/new/') 40 + ->setColor(PHUIButtonView::GREEN); 22 41 23 - $posts = id(new PhamePostQuery()) 24 - ->setViewer($viewer) 25 - ->withBlogPHIDs($blog_phids) 26 - ->withVisibility(PhameConstants::VISIBILITY_PUBLISHED) 27 - ->executeWithCursorPager($pager); 42 + $post_list = id(new PHUIBigInfoView()) 43 + ->setIcon('fa-star') 44 + ->setTitle('Welcome to Phame') 45 + ->setDescription( 46 + pht('There aren\'t any visible Blog Posts.')) 47 + ->addAction($create_button); 48 + } 28 49 29 50 $actions = $this->renderActions($viewer); 30 51 $action_button = id(new PHUIButtonView()) ··· 40 61 $header = id(new PHUIHeaderView()) 41 62 ->setHeader($title) 42 63 ->addActionLink($action_button); 43 - 44 - $post_list = id(new PhamePostListView()) 45 - ->setPosts($posts) 46 - ->setViewer($viewer) 47 - ->showBlog(true) 48 - ->setNodata(pht('No Recent Visible Posts.')); 49 64 50 65 $crumbs = $this->buildApplicationCrumbs(); 51 66 $crumbs->setBorder(true);
+29 -6
src/applications/phame/controller/blog/PhameBlogViewController.php
··· 57 57 $header->setPolicyObject($blog); 58 58 } 59 59 60 - $post_list = id(new PhamePostListView()) 61 - ->setPosts($posts) 62 - ->setViewer($viewer) 63 - ->setIsExternal($is_external) 64 - ->setIsLive($is_live) 65 - ->setNodata(pht('This blog has no visible posts.')); 60 + if ($posts) { 61 + $post_list = id(new PhamePostListView()) 62 + ->setPosts($posts) 63 + ->setViewer($viewer) 64 + ->setIsExternal($is_external) 65 + ->setIsLive($is_live) 66 + ->setNodata(pht('This blog has no visible posts.')); 67 + } else { 68 + $create_button = id(new PHUIButtonView()) 69 + ->setTag('a') 70 + ->setText(pht('Write a Post')) 71 + ->setHref($this->getApplicationURI('post/edit/?blog='.$blog->getID())) 72 + ->setColor(PHUIButtonView::GREEN); 73 + 74 + $post_list = id(new PHUIBigInfoView()) 75 + ->setIcon('fa-star') 76 + ->setTitle($blog->getName()) 77 + ->setDescription( 78 + pht('No one has written any blog posts yet.')); 79 + 80 + $can_edit = PhabricatorPolicyFilter::hasCapability( 81 + $viewer, 82 + $blog, 83 + PhabricatorPolicyCapability::CAN_EDIT); 84 + 85 + if ($can_edit) { 86 + $post_list->addAction($create_button); 87 + } 88 + } 66 89 67 90 $page = id(new PHUIDocumentViewPro()) 68 91 ->setHeader($header)