mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-15 09:11:07 +01:00
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
This commit is contained in:
parent
366861f106
commit
5f02ed5bbb
7 changed files with 102 additions and 48 deletions
|
@ -79,7 +79,7 @@ return array(
|
||||||
'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b',
|
'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b',
|
||||||
'rsrc/css/application/paste/paste.css' => 'aa1767d1',
|
'rsrc/css/application/paste/paste.css' => 'aa1767d1',
|
||||||
'rsrc/css/application/people/people-profile.css' => 'ba7b2762',
|
'rsrc/css/application/people/people-profile.css' => 'ba7b2762',
|
||||||
'rsrc/css/application/phame/phame.css' => '450826e1',
|
'rsrc/css/application/phame/phame.css' => '19ecc703',
|
||||||
'rsrc/css/application/pholio/pholio-edit.css' => 'b9e59b6d',
|
'rsrc/css/application/pholio/pholio-edit.css' => 'b9e59b6d',
|
||||||
'rsrc/css/application/pholio/pholio-inline-comments.css' => '52be33f0',
|
'rsrc/css/application/pholio/pholio-inline-comments.css' => '52be33f0',
|
||||||
'rsrc/css/application/pholio/pholio.css' => '2fa97dbe',
|
'rsrc/css/application/pholio/pholio.css' => '2fa97dbe',
|
||||||
|
@ -734,7 +734,7 @@ return array(
|
||||||
'phabricator-uiexample-reactor-sendclass' => 'bf97561d',
|
'phabricator-uiexample-reactor-sendclass' => 'bf97561d',
|
||||||
'phabricator-uiexample-reactor-sendproperties' => '551add57',
|
'phabricator-uiexample-reactor-sendproperties' => '551add57',
|
||||||
'phabricator-zindex-css' => '0d89d53c',
|
'phabricator-zindex-css' => '0d89d53c',
|
||||||
'phame-css' => '450826e1',
|
'phame-css' => '19ecc703',
|
||||||
'pholio-css' => '2fa97dbe',
|
'pholio-css' => '2fa97dbe',
|
||||||
'pholio-edit-css' => 'b9e59b6d',
|
'pholio-edit-css' => 'b9e59b6d',
|
||||||
'pholio-inline-comments-css' => '52be33f0',
|
'pholio-inline-comments-css' => '52be33f0',
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group phame
|
|
||||||
*/
|
|
||||||
abstract class PhameController extends PhabricatorController {
|
abstract class PhameController extends PhabricatorController {
|
||||||
|
|
||||||
protected function renderSideNavFilterView() {
|
protected function renderSideNavFilterView() {
|
||||||
|
@ -32,7 +29,7 @@ abstract class PhameController extends PhabricatorController {
|
||||||
|
|
||||||
protected function renderPostList(
|
protected function renderPostList(
|
||||||
array $posts,
|
array $posts,
|
||||||
PhabricatorUser $user,
|
PhabricatorUser $viewer,
|
||||||
$nodata) {
|
$nodata) {
|
||||||
assert_instances_of($posts, 'PhamePost');
|
assert_instances_of($posts, 'PhamePost');
|
||||||
|
|
||||||
|
@ -77,15 +74,33 @@ abstract class PhameController extends PhabricatorController {
|
||||||
->setImage($bloggerImage)
|
->setImage($bloggerImage)
|
||||||
->setImageHref($bloggerURI)
|
->setImageHref($bloggerURI)
|
||||||
->setAppIcon('phame-dark')
|
->setAppIcon('phame-dark')
|
||||||
->setUser($user)
|
->setUser($viewer)
|
||||||
->setPontification($phame_post, $phame_title);
|
->setPontification($phame_post, $phame_title);
|
||||||
|
|
||||||
|
if (PhabricatorPolicyFilter::hasCapability(
|
||||||
|
$viewer,
|
||||||
|
$post,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT)) {
|
||||||
|
|
||||||
|
$story->addAction(id(new PHUIIconView())
|
||||||
|
->setHref($this->getApplicationURI('post/edit/'.$post->getID().'/'))
|
||||||
|
->setText(pht('Edit'))
|
||||||
|
->setIconFont('fa-pencil'));
|
||||||
|
}
|
||||||
|
|
||||||
if ($post->getDatePublished()) {
|
if ($post->getDatePublished()) {
|
||||||
$story->setEpoch($post->getDatePublished());
|
$story->setEpoch($post->getDatePublished());
|
||||||
}
|
}
|
||||||
|
|
||||||
$stories[] = $story;
|
$stories[] = $story;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($stories)) {
|
||||||
|
return id(new AphrontErrorView())
|
||||||
|
->setSeverity(AphrontErrorView::SEVERITY_NODATA)
|
||||||
|
->appendChild($nodata);
|
||||||
|
}
|
||||||
|
|
||||||
return $stories;
|
return $stories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group phame
|
|
||||||
*/
|
|
||||||
final class PhameBlogEditController
|
final class PhameBlogEditController
|
||||||
extends PhameController {
|
extends PhameController {
|
||||||
|
|
||||||
|
@ -66,19 +63,28 @@ final class PhameBlogEditController
|
||||||
$blog->setDescription($description);
|
$blog->setDescription($description);
|
||||||
$blog->setDomain(nonempty($custom_domain, null));
|
$blog->setDomain(nonempty($custom_domain, null));
|
||||||
$blog->setSkin($skin);
|
$blog->setSkin($skin);
|
||||||
|
|
||||||
if (!empty($custom_domain)) {
|
|
||||||
$error = $blog->validateCustomDomain($custom_domain);
|
|
||||||
if ($error) {
|
|
||||||
$errors[] = $error;
|
|
||||||
$e_custom_domain = pht('Invalid');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$blog->setViewPolicy($request->getStr('can_view'));
|
$blog->setViewPolicy($request->getStr('can_view'));
|
||||||
$blog->setEditPolicy($request->getStr('can_edit'));
|
$blog->setEditPolicy($request->getStr('can_edit'));
|
||||||
$blog->setJoinPolicy($request->getStr('can_join'));
|
$blog->setJoinPolicy($request->getStr('can_join'));
|
||||||
|
|
||||||
|
if (!empty($custom_domain)) {
|
||||||
|
list($error_label, $error_text) =
|
||||||
|
$blog->validateCustomDomain($custom_domain);
|
||||||
|
if ($error_label) {
|
||||||
|
$errors[] = $error_text;
|
||||||
|
$e_custom_domain = $error_label;
|
||||||
|
}
|
||||||
|
if ($blog->getJoinPolicy() != PhabricatorPolicies::POLICY_PUBLIC) {
|
||||||
|
$errors[] = pht(
|
||||||
|
'For custom domains to work, the blog must have a view policy of '.
|
||||||
|
'public.');
|
||||||
|
// Prefer earlier labels for the multiple error scenario.
|
||||||
|
if (!$e_custom_domain) {
|
||||||
|
$e_custom_domain = pht('Invalid Policy');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Don't let users remove their ability to edit blogs.
|
// Don't let users remove their ability to edit blogs.
|
||||||
PhabricatorPolicyFilter::mustRetainCapability(
|
PhabricatorPolicyFilter::mustRetainCapability(
|
||||||
$user,
|
$user,
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group phame
|
|
||||||
*/
|
|
||||||
final class PhameBlog extends PhameDAO
|
final class PhameBlog extends PhameDAO
|
||||||
implements PhabricatorPolicyInterface, PhabricatorMarkupInterface {
|
implements PhabricatorPolicyInterface, PhabricatorMarkupInterface {
|
||||||
|
|
||||||
|
@ -69,38 +66,59 @@ final class PhameBlog extends PhameDAO
|
||||||
*/
|
*/
|
||||||
public function validateCustomDomain($custom_domain) {
|
public function validateCustomDomain($custom_domain) {
|
||||||
$example_domain = 'blog.example.com';
|
$example_domain = 'blog.example.com';
|
||||||
|
$label = pht('Invalid');
|
||||||
|
|
||||||
// note this "uri" should be pretty busted given the desired input
|
// note this "uri" should be pretty busted given the desired input
|
||||||
// so just use it to test if there's a protocol specified
|
// so just use it to test if there's a protocol specified
|
||||||
$uri = new PhutilURI($custom_domain);
|
$uri = new PhutilURI($custom_domain);
|
||||||
if ($uri->getProtocol()) {
|
if ($uri->getProtocol()) {
|
||||||
return pht(
|
return array($label,
|
||||||
|
pht(
|
||||||
'The custom domain should not include a protocol. Just provide '.
|
'The custom domain should not include a protocol. Just provide '.
|
||||||
'the bare domain name (for example, "%s").',
|
'the bare domain name (for example, "%s").',
|
||||||
$example_domain);
|
$example_domain));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($uri->getPort()) {
|
if ($uri->getPort()) {
|
||||||
return pht(
|
return array($label,
|
||||||
|
pht(
|
||||||
'The custom domain should not include a port number. Just provide '.
|
'The custom domain should not include a port number. Just provide '.
|
||||||
'the bare domain name (for example, "%s").',
|
'the bare domain name (for example, "%s").',
|
||||||
$example_domain);
|
$example_domain));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($custom_domain, '/') !== false) {
|
if (strpos($custom_domain, '/') !== false) {
|
||||||
return pht(
|
return array($label,
|
||||||
|
pht(
|
||||||
'The custom domain should not specify a path (hosting a Phame '.
|
'The custom domain should not specify a path (hosting a Phame '.
|
||||||
'blog at a path is currently not supported). Instead, just provide '.
|
'blog at a path is currently not supported). Instead, just provide '.
|
||||||
'the bare domain name (for example, "%s").',
|
'the bare domain name (for example, "%s").',
|
||||||
$example_domain);
|
$example_domain));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($custom_domain, '.') === false) {
|
if (strpos($custom_domain, '.') === false) {
|
||||||
return pht(
|
return array($label,
|
||||||
|
pht(
|
||||||
'The custom domain should contain at least one dot (.) because '.
|
'The custom domain should contain at least one dot (.) because '.
|
||||||
'some browsers fail to set cookies on domains without a dot. Instead, '.
|
'some browsers fail to set cookies on domains without a dot. '.
|
||||||
'use a normal looking domain name like "%s".',
|
'Instead, use a normal looking domain name like "%s".',
|
||||||
$example_domain);
|
$example_domain));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PhabricatorEnv::getEnvConfig('policy.allow-public')) {
|
||||||
|
$href = PhabricatorEnv::getProductionURI(
|
||||||
|
'/config/edit/policy.allow-public/');
|
||||||
|
return array(pht('Fix Configuration'),
|
||||||
|
pht(
|
||||||
|
'For custom domains to work, this Phabricator instance must be '.
|
||||||
|
'configured to allow the public access policy. Configure this '.
|
||||||
|
'setting %s, or ask an administrator to configure this setting. '.
|
||||||
|
'The domain can be specified later once this setting has been '.
|
||||||
|
'changed.',
|
||||||
|
phutil_tag(
|
||||||
|
'a',
|
||||||
|
array('href' => $href),
|
||||||
|
pht('here'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group phame
|
|
||||||
*/
|
|
||||||
final class PhamePost extends PhameDAO
|
final class PhamePost extends PhameDAO
|
||||||
implements
|
implements
|
||||||
PhabricatorPolicyInterface,
|
PhabricatorPolicyInterface,
|
||||||
|
@ -59,6 +56,10 @@ final class PhamePost extends PhameDAO
|
||||||
return PhabricatorEnv::getProductionURI($uri);
|
return PhabricatorEnv::getProductionURI($uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEditURI() {
|
||||||
|
return '/phame/post/edit/'.$this->getID().'/';
|
||||||
|
}
|
||||||
|
|
||||||
public function isDraft() {
|
public function isDraft() {
|
||||||
return $this->getVisibility() == self::VISIBILITY_DRAFT;
|
return $this->getVisibility() == self::VISIBILITY_DRAFT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,16 +29,22 @@ a name, description, and set of bloggers who can add posts to the blog.
|
||||||
Each blogger can also edit metadata about the blog and delete the blog
|
Each blogger can also edit metadata about the blog and delete the blog
|
||||||
outright.
|
outright.
|
||||||
|
|
||||||
Soon, blogs will be useful for powering external websites, like
|
NOTE: removing a blogger from a given blog does not remove their posts that
|
||||||
|
are already associated with the blog. Rather, it removes their ability to edit
|
||||||
|
metadata about and add posts to the blog.
|
||||||
|
|
||||||
|
Blogs can be useful for powering external websites, like
|
||||||
|
|
||||||
blog.yourcompany.com
|
blog.yourcompany.com
|
||||||
|
|
||||||
by making pertinent configuration changes with your DNS authority and
|
by making pertinent configuration changes with your DNS authority and
|
||||||
Phabricator instance.
|
Phabricator instance. For the Phabricator instance, you must
|
||||||
|
|
||||||
NOTE: removing a blogger from a given blog does not remove their posts that
|
- Enable `policy.allow-public` in Phabricator configuration.
|
||||||
are already associated with the blog. Rather, it removes their ability to edit
|
- Configure the blog to have the view policy `public`.
|
||||||
metadata about and add posts to the blog.
|
|
||||||
|
For your DNS authority, simply point the pertinent domain name at your
|
||||||
|
Phabricator instance. e.g. by IP address.
|
||||||
|
|
||||||
= Comment Widgets =
|
= Comment Widgets =
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,14 @@
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phame-post-list .aphront-error-view {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phame-post-list .phui-icon-view:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
.blog-post-list {
|
.blog-post-list {
|
||||||
clear: left;
|
clear: left;
|
||||||
float: left;
|
float: left;
|
||||||
|
|
Loading…
Reference in a new issue