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

Clean up URIs in Phame

Summary: Normalize "getViewURI" and "getLiveURI" for PhameBlog and PhamePost. Use pretty URIs in PhamePost

Test Plan: View Recent, View posts, edit post, new post, move post, view live.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

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

+27 -25
+1
src/applications/phame/application/PhabricatorPhameApplication.php
··· 47 47 'edit/(?:(?P<id>[^/]+)/)?' => 'PhamePostEditController', 48 48 'history/(?P<id>\d+)/' => 'PhamePostHistoryController', 49 49 'view/(?P<id>\d+)/' => 'PhamePostViewController', 50 + 'view/(?P<id>\d+)/(?P<slug>[^/]+)/' => 'PhamePostViewController', 50 51 'publish/(?P<id>\d+)/' => 'PhamePostPublishController', 51 52 'preview/(?P<id>\d+)/' => 'PhamePostPreviewController', 52 53 'unpublish/(?P<id>\d+)/' => 'PhamePostUnpublishController',
+1 -1
src/applications/phame/controller/blog/PhameBlogFeedController.php
··· 62 62 foreach ($posts as $post) { 63 63 $content[] = hsprintf('<entry>'); 64 64 $content[] = phutil_tag('title', array(), $post->getTitle()); 65 - $content[] = phutil_tag('link', array('href' => $post->getViewURI())); 65 + $content[] = phutil_tag('link', array('href' => $post->getLiveURI())); 66 66 67 67 $content[] = phutil_tag('id', array(), PhabricatorEnv::getProductionURI( 68 68 '/phame/post/view/'.$post->getID().'/'));
+12 -3
src/applications/phame/controller/post/PhamePostEditController.php
··· 6 6 $viewer = $request->getViewer(); 7 7 $id = $request->getURIData('id'); 8 8 9 + $crumbs = $this->buildApplicationCrumbs(); 10 + $crumbs->addTextCrumb( 11 + pht('Blogs'), 12 + $this->getApplicationURI('blog/')); 9 13 if ($id) { 10 14 $post = id(new PhamePostQuery()) 11 15 ->setViewer($viewer) ··· 29 33 $v_projects = array_reverse($v_projects); 30 34 $v_cc = PhabricatorSubscribersQuery::loadSubscribersForPHID( 31 35 $post->getPHID()); 36 + $blog = $post->getBlog(); 37 + 38 + 32 39 } else { 33 40 $blog = id(new PhameBlogQuery()) 34 41 ->setViewer($viewer) ··· 102 109 try { 103 110 $editor->applyTransactions($post, $xactions); 104 111 105 - $uri = $this->getApplicationURI('/post/view/'.$post->getID().'/'); 112 + $uri = $post->getViewURI(); 106 113 return id(new AphrontRedirectResponse())->setURI($uri); 107 114 } catch (PhabricatorApplicationTransactionValidationException $ex) { 108 115 $validation_exception = $ex; ··· 192 199 ->setValidationException($validation_exception) 193 200 ->setForm($form); 194 201 195 - $crumbs = $this->buildApplicationCrumbs(); 202 + $crumbs->addTextCrumb( 203 + $blog->getName(), 204 + $blog->getViewURI()); 196 205 $crumbs->addTextCrumb( 197 206 $page_title, 198 - $this->getApplicationURI('/post/view/'.$id.'/')); 207 + $cancel_uri); 199 208 200 209 return $this->newPage() 201 210 ->setTitle($page_title)
+2 -9
src/applications/phame/controller/post/PhamePostNotLiveController.php
··· 15 15 } 16 16 17 17 $reasons = array(); 18 - if (!$post->getBlog()) { 19 - $reasons[] = phutil_tag('p', array(), pht( 20 - 'You can not view the live version of this post because it '. 21 - 'is not associated with a blog. Move the post to a blog in order to '. 22 - 'view it live.')); 23 - } 24 - 25 18 if ($post->isDraft()) { 26 19 $reasons[] = phutil_tag('p', array(), pht( 27 20 'You can not view the live version of this post because it '. 28 - 'is still a draft. Use "Preview/Publish" to publish the post.')); 21 + 'is still a draft. Use "Preview" or "Publish" to publish the post.')); 29 22 } 30 23 31 24 if ($reasons) { ··· 45 38 46 39 // No reason this can't go live, maybe an old link. Kick them live and see 47 40 // what happens. 48 - $live_uri = $post->getViewURI(); 41 + $live_uri = $post->getLiveURI(); 49 42 return id(new AphrontRedirectResponse())->setURI($live_uri); 50 43 } 51 44
+3 -9
src/applications/phame/controller/post/PhamePostViewController.php
··· 25 25 $crumbs->addTextCrumb( 26 26 pht('Blogs'), 27 27 $this->getApplicationURI('blog/')); 28 - if ($blog) { 29 - $crumbs->addTextCrumb( 30 - $blog->getName(), 31 - $this->getApplicationURI('blog/view/'.$blog->getID().'/')); 32 - } else { 33 - $crumbs->addTextCrumb( 34 - pht('[No Blog]'), 35 - null); 36 - } 28 + $crumbs->addTextCrumb( 29 + $blog->getName(), 30 + $this->getApplicationURI('blog/view/'.$blog->getID().'/')); 37 31 $crumbs->addTextCrumb( 38 32 $post->getTitle(), 39 33 $this->getApplicationURI('post/view/'.$post->getID().'/'));
+1 -1
src/applications/phame/query/PhamePostSearchEngine.php
··· 93 93 ->setObject($post) 94 94 ->setHeader($post->getTitle()) 95 95 ->setStatusIcon('fa-star') 96 - ->setHref($this->getApplicationURI("/post/view/{$id}/")) 96 + ->setHref($post->getViewURI()) 97 97 ->addAttribute($blog_name); 98 98 if ($post->isDraft()) { 99 99 $item->setStatusIcon('fa-star-o grey');
+6 -1
src/applications/phame/storage/PhamePost.php
··· 48 48 return $this->blog; 49 49 } 50 50 51 - public function getViewURI() { 51 + public function getLiveURI() { 52 52 // go for the pretty uri if we can 53 53 $domain = ($this->blog ? $this->blog->getDomain() : ''); 54 54 if ($domain) { ··· 57 57 } 58 58 $uri = '/phame/post/view/'.$this->getID().'/'; 59 59 return PhabricatorEnv::getProductionURI($uri); 60 + } 61 + 62 + public function getViewURI() { 63 + $phame_title = PhabricatorSlug::normalize($this->getPhameTitle()); 64 + return '/phame/post/view/'.$this->getID().'/'.$phame_title; 60 65 } 61 66 62 67 public function getEditURI() {
+1 -1
src/applications/phame/view/PhamePostListView.php
··· 89 89 90 90 $item = id(new PHUIDocumentSummaryView()) 91 91 ->setTitle($post->getTitle()) 92 - ->setHref('/phame/post/view/'.$post->getID().'/') 92 + ->setHref($post->getViewURI()) 93 93 ->setSubtitle($subtitle) 94 94 ->setImage($blogger_image) 95 95 ->setImageHref($blogger_uri)