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

Phame - add some application polish.

Summary:
Fixes T4880. More specifically

- adds an "edit" pencil to post lists iff you can edit the post
- style change so this has no text-decoration
- adds a "no data" box if you have no posts in a given view
- style change to crush some margins so it formats like posts do
- adds some validation that your configuration is correct if you are specifying a custom domain
- updates docs about custom domains

Test Plan: clicked around and it was better! (see screenshots) read doc changes carefully

Reviewers: epriestley, chad

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T4880

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

+101 -47
+2 -2
resources/celerity/map.php
··· 79 79 'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b', 80 80 'rsrc/css/application/paste/paste.css' => 'aa1767d1', 81 81 'rsrc/css/application/people/people-profile.css' => 'ba7b2762', 82 - 'rsrc/css/application/phame/phame.css' => '450826e1', 82 + 'rsrc/css/application/phame/phame.css' => '19ecc703', 83 83 'rsrc/css/application/pholio/pholio-edit.css' => 'b9e59b6d', 84 84 'rsrc/css/application/pholio/pholio-inline-comments.css' => '52be33f0', 85 85 'rsrc/css/application/pholio/pholio.css' => '2fa97dbe', ··· 734 734 'phabricator-uiexample-reactor-sendclass' => 'bf97561d', 735 735 'phabricator-uiexample-reactor-sendproperties' => '551add57', 736 736 'phabricator-zindex-css' => '0d89d53c', 737 - 'phame-css' => '450826e1', 737 + 'phame-css' => '19ecc703', 738 738 'pholio-css' => '2fa97dbe', 739 739 'pholio-edit-css' => 'b9e59b6d', 740 740 'pholio-inline-comments-css' => '52be33f0',
+20 -5
src/applications/phame/controller/PhameController.php
··· 1 1 <?php 2 2 3 - /** 4 - * @group phame 5 - */ 6 3 abstract class PhameController extends PhabricatorController { 7 4 8 5 protected function renderSideNavFilterView() { ··· 32 29 33 30 protected function renderPostList( 34 31 array $posts, 35 - PhabricatorUser $user, 32 + PhabricatorUser $viewer, 36 33 $nodata) { 37 34 assert_instances_of($posts, 'PhamePost'); 38 35 ··· 77 74 ->setImage($bloggerImage) 78 75 ->setImageHref($bloggerURI) 79 76 ->setAppIcon('phame-dark') 80 - ->setUser($user) 77 + ->setUser($viewer) 81 78 ->setPontification($phame_post, $phame_title); 82 79 80 + if (PhabricatorPolicyFilter::hasCapability( 81 + $viewer, 82 + $post, 83 + PhabricatorPolicyCapability::CAN_EDIT)) { 84 + 85 + $story->addAction(id(new PHUIIconView()) 86 + ->setHref($this->getApplicationURI('post/edit/'.$post->getID().'/')) 87 + ->setText(pht('Edit')) 88 + ->setIconFont('fa-pencil')); 89 + } 90 + 83 91 if ($post->getDatePublished()) { 84 92 $story->setEpoch($post->getDatePublished()); 85 93 } 94 + 86 95 $stories[] = $story; 96 + } 97 + 98 + if (empty($stories)) { 99 + return id(new AphrontErrorView()) 100 + ->setSeverity(AphrontErrorView::SEVERITY_NODATA) 101 + ->appendChild($nodata); 87 102 } 88 103 89 104 return $stories;
+17 -11
src/applications/phame/controller/blog/PhameBlogEditController.php
··· 1 1 <?php 2 2 3 - /** 4 - * @group phame 5 - */ 6 3 final class PhameBlogEditController 7 4 extends PhameController { 8 5 ··· 66 63 $blog->setDescription($description); 67 64 $blog->setDomain(nonempty($custom_domain, null)); 68 65 $blog->setSkin($skin); 66 + $blog->setViewPolicy($request->getStr('can_view')); 67 + $blog->setEditPolicy($request->getStr('can_edit')); 68 + $blog->setJoinPolicy($request->getStr('can_join')); 69 69 70 70 if (!empty($custom_domain)) { 71 - $error = $blog->validateCustomDomain($custom_domain); 72 - if ($error) { 73 - $errors[] = $error; 74 - $e_custom_domain = pht('Invalid'); 71 + list($error_label, $error_text) = 72 + $blog->validateCustomDomain($custom_domain); 73 + if ($error_label) { 74 + $errors[] = $error_text; 75 + $e_custom_domain = $error_label; 76 + } 77 + if ($blog->getJoinPolicy() != PhabricatorPolicies::POLICY_PUBLIC) { 78 + $errors[] = pht( 79 + 'For custom domains to work, the blog must have a view policy of '. 80 + 'public.'); 81 + // Prefer earlier labels for the multiple error scenario. 82 + if (!$e_custom_domain) { 83 + $e_custom_domain = pht('Invalid Policy'); 84 + } 75 85 } 76 86 } 77 - 78 - $blog->setViewPolicy($request->getStr('can_view')); 79 - $blog->setEditPolicy($request->getStr('can_edit')); 80 - $blog->setJoinPolicy($request->getStr('can_join')); 81 87 82 88 // Don't let users remove their ability to edit blogs. 83 89 PhabricatorPolicyFilter::mustRetainCapability(
+39 -21
src/applications/phame/storage/PhameBlog.php
··· 1 1 <?php 2 2 3 - /** 4 - * @group phame 5 - */ 6 3 final class PhameBlog extends PhameDAO 7 4 implements PhabricatorPolicyInterface, PhabricatorMarkupInterface { 8 5 ··· 69 66 */ 70 67 public function validateCustomDomain($custom_domain) { 71 68 $example_domain = 'blog.example.com'; 69 + $label = pht('Invalid'); 72 70 73 71 // note this "uri" should be pretty busted given the desired input 74 72 // so just use it to test if there's a protocol specified 75 73 $uri = new PhutilURI($custom_domain); 76 74 if ($uri->getProtocol()) { 77 - return pht( 78 - 'The custom domain should not include a protocol. Just provide '. 79 - 'the bare domain name (for example, "%s").', 80 - $example_domain); 75 + return array($label, 76 + pht( 77 + 'The custom domain should not include a protocol. Just provide '. 78 + 'the bare domain name (for example, "%s").', 79 + $example_domain)); 81 80 } 82 81 83 82 if ($uri->getPort()) { 84 - return pht( 85 - 'The custom domain should not include a port number. Just provide '. 86 - 'the bare domain name (for example, "%s").', 87 - $example_domain); 83 + return array($label, 84 + pht( 85 + 'The custom domain should not include a port number. Just provide '. 86 + 'the bare domain name (for example, "%s").', 87 + $example_domain)); 88 88 } 89 89 90 90 if (strpos($custom_domain, '/') !== false) { 91 - return pht( 92 - 'The custom domain should not specify a path (hosting a Phame '. 93 - 'blog at a path is currently not supported). Instead, just provide '. 94 - 'the bare domain name (for example, "%s").', 95 - $example_domain); 91 + return array($label, 92 + pht( 93 + 'The custom domain should not specify a path (hosting a Phame '. 94 + 'blog at a path is currently not supported). Instead, just provide '. 95 + 'the bare domain name (for example, "%s").', 96 + $example_domain)); 96 97 } 97 98 98 99 if (strpos($custom_domain, '.') === false) { 99 - return pht( 100 - 'The custom domain should contain at least one dot (.) because '. 101 - 'some browsers fail to set cookies on domains without a dot. Instead, '. 102 - 'use a normal looking domain name like "%s".', 103 - $example_domain); 100 + return array($label, 101 + pht( 102 + 'The custom domain should contain at least one dot (.) because '. 103 + 'some browsers fail to set cookies on domains without a dot. '. 104 + 'Instead, use a normal looking domain name like "%s".', 105 + $example_domain)); 106 + } 107 + 108 + if (!PhabricatorEnv::getEnvConfig('policy.allow-public')) { 109 + $href = PhabricatorEnv::getProductionURI( 110 + '/config/edit/policy.allow-public/'); 111 + return array(pht('Fix Configuration'), 112 + pht( 113 + 'For custom domains to work, this Phabricator instance must be '. 114 + 'configured to allow the public access policy. Configure this '. 115 + 'setting %s, or ask an administrator to configure this setting. '. 116 + 'The domain can be specified later once this setting has been '. 117 + 'changed.', 118 + phutil_tag( 119 + 'a', 120 + array('href' => $href), 121 + pht('here')))); 104 122 } 105 123 106 124 return null;
+4 -3
src/applications/phame/storage/PhamePost.php
··· 1 1 <?php 2 2 3 - /** 4 - * @group phame 5 - */ 6 3 final class PhamePost extends PhameDAO 7 4 implements 8 5 PhabricatorPolicyInterface, ··· 57 54 } 58 55 $uri = '/phame/post/view/'.$this->getID().'/'; 59 56 return PhabricatorEnv::getProductionURI($uri); 57 + } 58 + 59 + public function getEditURI() { 60 + return '/phame/post/edit/'.$this->getID().'/'; 60 61 } 61 62 62 63 public function isDraft() {
+11 -5
src/docs/user/userguide/phame.diviner
··· 29 29 Each blogger can also edit metadata about the blog and delete the blog 30 30 outright. 31 31 32 - Soon, blogs will be useful for powering external websites, like 32 + NOTE: removing a blogger from a given blog does not remove their posts that 33 + are already associated with the blog. Rather, it removes their ability to edit 34 + metadata about and add posts to the blog. 35 + 36 + Blogs can be useful for powering external websites, like 33 37 34 38 blog.yourcompany.com 35 39 36 40 by making pertinent configuration changes with your DNS authority and 37 - Phabricator instance. 41 + Phabricator instance. For the Phabricator instance, you must 38 42 39 - NOTE: removing a blogger from a given blog does not remove their posts that 40 - are already associated with the blog. Rather, it removes their ability to edit 41 - metadata about and add posts to the blog. 43 + - Enable `policy.allow-public` in Phabricator configuration. 44 + - Configure the blog to have the view policy `public`. 45 + 46 + For your DNS authority, simply point the pertinent domain name at your 47 + Phabricator instance. e.g. by IP address. 42 48 43 49 = Comment Widgets = 44 50
+8
webroot/rsrc/css/application/phame/phame.css
··· 25 25 max-width: 600px; 26 26 } 27 27 28 + .phame-post-list .aphront-error-view { 29 + margin: 0; 30 + } 31 + 32 + .phame-post-list .phui-icon-view:hover { 33 + text-decoration: none; 34 + } 35 + 28 36 .blog-post-list { 29 37 clear: left; 30 38 float: left;