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

Allow Phame Posts to be ordered by datePublished

Summary: Adds some ordering options to PhamePost queries. Works on search, PhameHome, BlogHome

Test Plan: Try searching with Order By set to Date Published in application search, get correct order. Check a blog home page, check PhameHome.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9897

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

+32
+1
src/applications/phame/controller/PhameHomeController.php
··· 36 36 ->setViewer($viewer) 37 37 ->withBlogPHIDs($blog_phids) 38 38 ->withVisibility(array(PhameConstants::VISIBILITY_PUBLISHED)) 39 + ->setOrder('datePublished') 39 40 ->executeWithCursorPager($pager); 40 41 41 42 if ($posts) {
+1
src/applications/phame/controller/blog/PhameBlogViewController.php
··· 20 20 $post_query = id(new PhamePostQuery()) 21 21 ->setViewer($viewer) 22 22 ->withBlogPHIDs(array($blog->getPHID())) 23 + ->setOrder('datePublished') 23 24 ->withVisibility(array( 24 25 PhameConstants::VISIBILITY_PUBLISHED, 25 26 PhameConstants::VISIBILITY_DRAFT,
+30
src/applications/phame/query/PhamePostQuery.php
··· 122 122 return $where; 123 123 } 124 124 125 + public function getBuiltinOrders() { 126 + return array( 127 + 'datePublished' => array( 128 + 'vector' => array('datePublished', 'id'), 129 + 'name' => pht('Publish Date'), 130 + ), 131 + ) + parent::getBuiltinOrders(); 132 + } 133 + 134 + public function getOrderableColumns() { 135 + return parent::getOrderableColumns() + array( 136 + 'datePublished' => array( 137 + 'column' => 'datePublished', 138 + 'type' => 'int', 139 + 'reverse' => false, 140 + ), 141 + ); 142 + } 143 + 144 + protected function getPagingValueMap($cursor, array $keys) { 145 + $post = $this->loadCursorObject($cursor); 146 + 147 + $map = array( 148 + 'datePublished' => $post->getDatePublished(), 149 + 'id' => $post->getID(), 150 + ); 151 + 152 + return $map; 153 + } 154 + 125 155 public function getQueryApplicationClass() { 126 156 // TODO: Does setting this break public blogs? 127 157 return null;