Page MenuHomePhabricator

D13669.diff
No OneTemporary

D13669.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -6967,6 +6967,7 @@
'PhabricatorMarkupInterface',
'PhabricatorSubscribableInterface',
'PhabricatorFlaggableInterface',
+ 'PhabricatorProjectInterface',
'PhabricatorApplicationTransactionInterface',
),
'PhameBlogDeleteController' => 'PhameController',
@@ -6991,6 +6992,7 @@
'PhabricatorPolicyInterface',
'PhabricatorMarkupInterface',
'PhabricatorFlaggableInterface',
+ 'PhabricatorProjectInterface',
'PhabricatorApplicationTransactionInterface',
'PhabricatorSubscribableInterface',
'PhabricatorTokenReceiverInterface',
diff --git a/src/applications/phame/controller/blog/PhameBlogEditController.php b/src/applications/phame/controller/blog/PhameBlogEditController.php
--- a/src/applications/phame/controller/blog/PhameBlogEditController.php
+++ b/src/applications/phame/controller/blog/PhameBlogEditController.php
@@ -5,8 +5,8 @@
public function handleRequest(AphrontRequest $request) {
$user = $request->getUser();
-
$id = $request->getURIData('id');
+
if ($id) {
$blog = id(new PhameBlogQuery())
->setViewer($user)
@@ -23,12 +23,19 @@
$submit_button = pht('Save Changes');
$page_title = pht('Edit Blog');
$cancel_uri = $this->getApplicationURI('blog/view/'.$blog->getID().'/');
+
+ $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $blog->getPHID(),
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
+ $v_projects = array_reverse($v_projects);
+
} else {
$blog = PhameBlog::initializeNewBlog($user);
$submit_button = pht('Create Blog');
$page_title = pht('Create Blog');
$cancel_uri = $this->getApplicationURI();
+ $v_projects = array();
}
$name = $blog->getName();
$description = $blog->getDescription();
@@ -50,6 +57,7 @@
$can_view = $request->getStr('can_view');
$can_edit = $request->getStr('can_edit');
$can_join = $request->getStr('can_join');
+ $v_projects = $request->getArr('projects');
$xactions = array(
id(new PhameBlogTransaction())
@@ -75,6 +83,12 @@
->setNewValue($can_join),
);
+ $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
+ $xactions[] = id(new PhameBlogTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $proj_edge_type)
+ ->setNewValue(array('=' => array_fuse($v_projects)));
+
$editor = id(new PhameBlogEditor())
->setActor($user)
->setContentSourceFromRequest($request)
@@ -147,6 +161,12 @@
->setPolicies($policies)
->setValue($can_join)
->setName('can_join'))
+ ->appendControl(
+ id(new AphrontFormTokenizerControl())
+ ->setLabel(pht('Projects'))
+ ->setName('projects')
+ ->setValue($v_projects)
+ ->setDatasource(new PhabricatorProjectDatasource()))
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Custom Domain'))
diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php
--- a/src/applications/phame/controller/blog/PhameBlogViewController.php
+++ b/src/applications/phame/controller/blog/PhameBlogViewController.php
@@ -72,8 +72,10 @@
require_celerity_resource('aphront-tooltip-css');
Javelin::initBehavior('phabricator-tooltips');
- $properties = new PHUIPropertyListView();
- $properties->setActionList($actions);
+ $properties = id(new PHUIPropertyListView())
+ ->setUser($user)
+ ->setObject($blog)
+ ->setActionList($actions);
$properties->addProperty(
pht('Skin'),
@@ -115,13 +117,18 @@
->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)
->process();
- $properties->addTextContent(
- phutil_tag(
- 'div',
- array(
- 'class' => 'phabricator-remarkup',
- ),
- $engine->getOutput($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)));
+ $properties->invokeWillRenderEvent();
+
+ if (strlen($blog->getDescription())) {
+ $description = PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()),
+ 'default',
+ $user);
+ $properties->addSectionHeader(
+ pht('Description'),
+ PHUIPropertyListView::ICON_SUMMARY);
+ $properties->addTextContent($description);
+ }
return $properties;
}
diff --git a/src/applications/phame/controller/post/PhamePostEditController.php b/src/applications/phame/controller/post/PhamePostEditController.php
--- a/src/applications/phame/controller/post/PhamePostEditController.php
+++ b/src/applications/phame/controller/post/PhamePostEditController.php
@@ -22,6 +22,11 @@
$cancel_uri = $this->getApplicationURI('/post/view/'.$id.'/');
$submit_button = pht('Save Changes');
$page_title = pht('Edit Post');
+
+ $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $post->getPHID(),
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
+ $v_projects = array_reverse($v_projects);
} else {
$blog = id(new PhameBlogQuery())
->setViewer($user)
@@ -35,6 +40,7 @@
if (!$blog) {
return new Aphront404Response();
}
+ $v_projects = array();
$post = PhamePost::initializePost($user, $blog);
$cancel_uri = $this->getApplicationURI('/blog/view/'.$blog->getID().'/');
@@ -57,6 +63,7 @@
$phame_title = PhabricatorSlug::normalize($phame_title);
$body = $request->getStr('body');
$comments_widget = $request->getStr('comments_widget');
+ $v_projects = $request->getArr('projects');
$xactions = array(
id(new PhamePostTransaction())
@@ -73,6 +80,12 @@
->setNewValue($comments_widget),
);
+ $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
+ $xactions[] = id(new PhamePostTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $proj_edge_type)
+ ->setNewValue(array('=' => array_fuse($v_projects)));
+
$editor = id(new PhamePostEditor())
->setActor($user)
->setContentSourceFromRequest($request)
@@ -130,6 +143,12 @@
->setID('post-body')
->setUser($user)
->setDisableMacros(true))
+ ->appendControl(
+ id(new AphrontFormTokenizerControl())
+ ->setLabel(pht('Projects'))
+ ->setName('projects')
+ ->setValue($v_projects)
+ ->setDatasource(new PhabricatorProjectDatasource()))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Comments Widget'))
diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php
--- a/src/applications/phame/storage/PhameBlog.php
+++ b/src/applications/phame/storage/PhameBlog.php
@@ -6,6 +6,7 @@
PhabricatorMarkupInterface,
PhabricatorSubscribableInterface,
PhabricatorFlaggableInterface,
+ PhabricatorProjectInterface,
PhabricatorApplicationTransactionInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php
--- a/src/applications/phame/storage/PhamePost.php
+++ b/src/applications/phame/storage/PhamePost.php
@@ -5,6 +5,7 @@
PhabricatorPolicyInterface,
PhabricatorMarkupInterface,
PhabricatorFlaggableInterface,
+ PhabricatorProjectInterface,
PhabricatorApplicationTransactionInterface,
PhabricatorSubscribableInterface,
PhabricatorTokenReceiverInterface {

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 5:52 PM (9 h, 39 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6927325
Default Alt Text
D13669.diff (7 KB)

Event Timeline