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

tweak pager and title in basic => template skin

Summary: its a bit confusing but "newer" posts are the "previous" page and "older" posts are the "next" page. this is because newer posts are those with higher ids. also make the title be the title of the post if we have an actual post.

Test Plan: set page limit to 5 and got somewhat sensical results (note this pagination seems to break with my test data set where there's fun gaps in the contiguity of the ids in a given blog) viewed an actual post and noted the page title was the post title

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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

+22 -11
+14 -3
src/applications/phame/skins/PhameBasicBlogSkin.php
··· 8 8 abstract class PhameBasicBlogSkin extends PhameBlogSkin { 9 9 10 10 private $pager; 11 + private $title; 12 + 13 + protected function setTitle($title) { 14 + $this->title = $title; 15 + return $this; 16 + } 17 + protected function getTitle() { 18 + return $this->title; 19 + } 11 20 12 21 public function processRequest() { 13 22 $request = $this->getRequest(); ··· 145 154 */ 146 155 protected function getNewerPageURI() { 147 156 if ($this->pager) { 148 - $next = $this->pager->getNextPageID(); 157 + $next = $this->pager->getPrevPageID(); 149 158 if ($next) { 150 159 return $this->getURI('newer/'.$next.'/'); 151 160 } ··· 183 192 184 193 $matches = null; 185 194 $path = $request->getPath(); 195 + $this->setTitle($this->getBlog()->getName()); 186 196 if (preg_match('@^/post/(?P<name>.*)$@', $path, $matches)) { 187 197 $post = id(new PhamePostQuery()) 188 198 ->setViewer($user) ··· 191 201 ->executeOne(); 192 202 193 203 if ($post) { 204 + $this->setTitle($post->getTitle()); 194 205 $view = head($this->buildPostViews(array($post))); 195 206 return $this->renderPostDetail($view); 196 207 } ··· 198 209 $pager = new AphrontCursorPagerView(); 199 210 200 211 if (preg_match('@^/older/(?P<before>\d+)/$@', $path, $matches)) { 201 - $pager->setBeforeID($matches['before']); 212 + $pager->setAfterID($matches['before']); 202 213 } else if (preg_match('@^/newer/(?P<after>\d)/$@', $path, $matches)) { 203 - $pager->setAfterID($matches['after']); 214 + $pager->setBeforeID($matches['after']); 204 215 } else if (preg_match('@^/$@', $path, $matches)) { 205 216 // Just show the first page. 206 217 } else {
+8 -8
src/applications/phame/skins/PhameBasicTemplateBlogSkin.php
··· 80 80 81 81 private function getDefaultScope() { 82 82 return array( 83 - 'skin' => $this, 84 - 'blog' => $this->getBlog(), 85 - 'uri' => $this->getURI(''), 83 + 'skin' => $this, 84 + 'blog' => $this->getBlog(), 85 + 'uri' => $this->getURI(''), 86 + 'title' => $this->getTitle(), 86 87 ); 87 88 } 88 89 89 90 protected function renderHeader() { 90 91 return $this->renderTemplate( 91 92 'header.php', 92 - array( 93 - 'title' => $this->getBlog()->getName(), 94 - )); 93 + array() 94 + ); 95 95 } 96 96 97 97 protected function renderFooter() { ··· 115 115 'post-list.php', 116 116 array( 117 117 'posts' => $posts, 118 - 'older' => $this->renderNewerPageLink(), 119 - 'newer' => $this->renderOlderPageLink(), 118 + 'older' => $this->renderOlderPageLink(), 119 + 'newer' => $this->renderNewerPageLink(), 120 120 )); 121 121 } 122 122