From 649f5cc178bf67ba0eac6705ba84fb39a0a5b24e Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Thu, 11 Apr 2013 16:10:09 -0700 Subject: [PATCH] Phame - fix some issues with feed reported on github (290, 291) Summary: we need a link with type=self to pass xml validation. Note we will always fail validation until we remove any sigil-related stuff from the resultant HTML since we just made that up for our purposes. Also serves up the feed link on the blog view controller, complete with tooltip about how the custom domain stuff isn't supported. Test Plan: viewed a blog page and liked the feed uri property. viewed a feed and verified the new link self stuff. post push I'll try the validator again. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin, vrana Differential Revision: https://secure.phabricator.com/D5667 --- .../blog/PhameBlogFeedController.php | 11 +++++++++-- .../blog/PhameBlogViewController.php | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/applications/phame/controller/blog/PhameBlogFeedController.php b/src/applications/phame/controller/blog/PhameBlogFeedController.php index e72e51edfa..8b42b2928f 100644 --- a/src/applications/phame/controller/blog/PhameBlogFeedController.php +++ b/src/applications/phame/controller/blog/PhameBlogFeedController.php @@ -33,10 +33,17 @@ final class PhameBlogFeedController extends PhameController { ->withVisibility(PhamePost::VISIBILITY_PUBLISHED) ->execute(); + $blog_uri = PhabricatorEnv::getProductionURI( + $this->getApplicationURI('blog/feed/'.$blog->getID().'/')); $content = array(); $content[] = phutil_tag('title', array(), $blog->getName()); - $content[] = phutil_tag('id', array(), PhabricatorEnv::getProductionURI( - '/phame/blog/view/'.$blog->getID().'/')); + $content[] = phutil_tag('id', array(), $blog_uri); + $content[] = phutil_tag('link', + array( + 'rel' => 'self', + 'type' => 'application/atom+xml', + 'href' => $blog_uri + )); $updated = $blog->getDateModified(); if ($posts) { diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php index 8accd39a1c..c6afaaf676 100644 --- a/src/applications/phame/controller/blog/PhameBlogViewController.php +++ b/src/applications/phame/controller/blog/PhameBlogViewController.php @@ -65,6 +65,9 @@ final class PhameBlogViewController extends PhameController { } private function renderProperties(PhameBlog $blog, PhabricatorUser $user) { + require_celerity_resource('aphront-tooltip-css'); + Javelin::initBehavior('phabricator-tooltips'); + $properties = new PhabricatorPropertyListView(); $properties->addProperty( @@ -75,6 +78,21 @@ final class PhameBlogViewController extends PhameController { pht('Domain'), $blog->getDomain()); + $feed_uri = PhabricatorEnv::getProductionURI( + $this->getApplicationURI('blog/feed/'.$blog->getID().'/')); + $properties->addProperty( + pht('Atom URI'), + javelin_tag('a', + array( + 'href' => $feed_uri, + 'sigil' => 'has-tooltip', + 'meta' => array( + 'tip' => pht('Atom URI does not support custom domains.'), + 'size' => 320, + ) + ), + $feed_uri)); + $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( $user, $blog);