Page MenuHomePhabricator

D16222.diff
No OneTemporary

D16222.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -81,7 +81,7 @@
'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b',
'rsrc/css/application/paste/paste.css' => '1898e534',
'rsrc/css/application/people/people-profile.css' => '2473d929',
- 'rsrc/css/application/phame/phame.css' => 'bf6a743f',
+ 'rsrc/css/application/phame/phame.css' => '8efb0729',
'rsrc/css/application/pholio/pholio-edit.css' => '07676f51',
'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49',
'rsrc/css/application/pholio/pholio.css' => 'ca89d380',
@@ -811,7 +811,7 @@
'phabricator-uiexample-reactor-sendclass' => '1def2711',
'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee',
'phabricator-zindex-css' => '5b6fcf3f',
- 'phame-css' => 'bf6a743f',
+ 'phame-css' => '8efb0729',
'pholio-css' => 'ca89d380',
'pholio-edit-css' => '07676f51',
'pholio-inline-comments-css' => '8e545e49',
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
@@ -3834,7 +3834,6 @@
'PhameNextPostView' => 'applications/phame/view/PhameNextPostView.php',
'PhamePost' => 'applications/phame/storage/PhamePost.php',
'PhamePostArchiveController' => 'applications/phame/controller/post/PhamePostArchiveController.php',
- 'PhamePostCommentController' => 'applications/phame/controller/post/PhamePostCommentController.php',
'PhamePostController' => 'applications/phame/controller/post/PhamePostController.php',
'PhamePostEditConduitAPIMethod' => 'applications/phame/conduit/PhamePostEditConduitAPIMethod.php',
'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php',
@@ -3848,6 +3847,7 @@
'PhamePostMoveController' => 'applications/phame/controller/post/PhamePostMoveController.php',
'PhamePostPublishController' => 'applications/phame/controller/post/PhamePostPublishController.php',
'PhamePostQuery' => 'applications/phame/query/PhamePostQuery.php',
+ 'PhamePostRemarkupRule' => 'applications/phame/remarkup/PhamePostRemarkupRule.php',
'PhamePostReplyHandler' => 'applications/phame/mail/PhamePostReplyHandler.php',
'PhamePostSearchConduitAPIMethod' => 'applications/phame/conduit/PhamePostSearchConduitAPIMethod.php',
'PhamePostSearchEngine' => 'applications/phame/query/PhamePostSearchEngine.php',
@@ -8760,7 +8760,6 @@
'PhabricatorFulltextInterface',
),
'PhamePostArchiveController' => 'PhamePostController',
- 'PhamePostCommentController' => 'PhamePostController',
'PhamePostController' => 'PhameController',
'PhamePostEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'PhamePostEditController' => 'PhamePostController',
@@ -8774,6 +8773,7 @@
'PhamePostMoveController' => 'PhamePostController',
'PhamePostPublishController' => 'PhamePostController',
'PhamePostQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
+ 'PhamePostRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'PhamePostReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PhamePostSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'PhamePostSearchEngine' => 'PhabricatorApplicationSearchEngine',
diff --git a/src/applications/phame/application/PhabricatorPhameApplication.php b/src/applications/phame/application/PhabricatorPhameApplication.php
--- a/src/applications/phame/application/PhabricatorPhameApplication.php
+++ b/src/applications/phame/application/PhabricatorPhameApplication.php
@@ -37,7 +37,8 @@
public function getRoutes() {
return array(
- '/phame/' => array(
+ '/J(?P<id>[1-9]\d*)' => 'PhamePostViewController',
+ '/phame/' => array(
'' => 'PhameHomeController',
// NOTE: The live routes include an initial "/", so leave it off
@@ -46,17 +47,16 @@
'post/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhamePostListController',
'blogger/(?P<bloggername>[\w\.-_]+)/' => 'PhamePostListController',
- 'edit/(?:(?P<id>[^/]+)/)?' => 'PhamePostEditController',
+ $this->getEditRoutePattern('edit/')
+ => 'PhamePostEditController',
'history/(?P<id>\d+)/' => 'PhamePostHistoryController',
'view/(?P<id>\d+)/(?:(?P<slug>[^/]+)/)?' => 'PhamePostViewController',
'(?P<action>publish|unpublish)/(?P<id>\d+)/'
=> 'PhamePostPublishController',
'preview/(?P<id>\d+)/' => 'PhamePostPreviewController',
'preview/' => 'PhabricatorMarkupPreviewController',
- 'framed/(?P<id>\d+)/' => 'PhamePostFramedController',
'move/(?P<id>\d+)/' => 'PhamePostMoveController',
'archive/(?P<id>\d+)/' => 'PhamePostArchiveController',
- 'comment/(?P<id>[1-9]\d*)/' => 'PhamePostCommentController',
),
'blog/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhameBlogListController',
@@ -107,6 +107,13 @@
);
}
+ public function getRemarkupRules() {
+ return array(
+ new PhamePostRemarkupRule(),
+ );
+ }
+
+
protected function getCustomCapabilities() {
return array(
PhameBlogCreateCapability::CAPABILITY => array(
diff --git a/src/applications/phame/controller/post/PhamePostCommentController.php b/src/applications/phame/controller/post/PhamePostCommentController.php
deleted file mode 100644
--- a/src/applications/phame/controller/post/PhamePostCommentController.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-final class PhamePostCommentController
- extends PhamePostController {
-
- public function handleRequest(AphrontRequest $request) {
- $viewer = $request->getViewer();
- $id = $request->getURIData('id');
-
- if (!$request->isFormPost()) {
- return new Aphront400Response();
- }
-
- $post = id(new PhamePostQuery())
- ->setViewer($viewer)
- ->withIDs(array($id))
- ->executeOne();
- if (!$post) {
- return new Aphront404Response();
- }
-
- $is_preview = $request->isPreviewRequest();
- $draft = PhabricatorDraft::buildFromRequest($request);
-
- $view_uri = $this->getApplicationURI('post/view/'.$post->getID().'/');
-
- $xactions = array();
- $xactions[] = id(new PhamePostTransaction())
- ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
- ->attachComment(
- id(new PhamePostTransactionComment())
- ->setContent($request->getStr('comment')));
-
- $editor = id(new PhamePostEditor())
- ->setActor($viewer)
- ->setContinueOnNoEffect($request->isContinueRequest())
- ->setContentSourceFromRequest($request)
- ->setIsPreview($is_preview);
-
- try {
- $xactions = $editor->applyTransactions($post, $xactions);
- } catch (PhabricatorApplicationTransactionNoEffectException $ex) {
- return id(new PhabricatorApplicationTransactionNoEffectResponse())
- ->setCancelURI($view_uri)
- ->setException($ex);
- }
-
- if ($draft) {
- $draft->replaceOrDelete();
- }
-
- if ($request->isAjax() && $is_preview) {
- return id(new PhabricatorApplicationTransactionResponse())
- ->setViewer($viewer)
- ->setTransactions($xactions)
- ->setIsPreview($is_preview);
- } else {
- return id(new AphrontRedirectResponse())
- ->setURI($view_uri);
- }
- }
-
-}
diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php
--- a/src/applications/phame/controller/post/PhamePostViewController.php
+++ b/src/applications/phame/controller/post/PhamePostViewController.php
@@ -123,19 +123,22 @@
->setImage($blogger->getProfileImageURI())
->setImageHref($author_uri);
+ $monogram = $post->getMonogram();
$timeline = $this->buildTransactionTimeline(
$post,
id(new PhamePostTransactionQuery())
->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT)));
- $timeline = phutil_tag_div('phui-document-view-pro-box', $timeline);
+ $timeline->setQuoteRef($monogram);
if ($is_external) {
$add_comment = null;
} else {
- $add_comment = $this->buildCommentForm($post);
- $add_comment = phutil_tag_div('mlb mlt', $add_comment);
+ $add_comment = $this->buildCommentForm($post, $timeline);
+ $add_comment = phutil_tag_div('mlb mlt phame-comment-view', $add_comment);
}
+ $timeline = phutil_tag_div('phui-document-view-pro-box', $timeline);
+
list($prev, $next) = $this->loadAdjacentPosts($post);
$properties = id(new PHUIPropertyListView())
@@ -273,19 +276,13 @@
return $actions;
}
- private function buildCommentForm(PhamePost $post) {
+ private function buildCommentForm(PhamePost $post, $timeline) {
$viewer = $this->getViewer();
- $draft = PhabricatorDraft::newFromUserAndKey(
- $viewer, $post->getPHID());
-
- $box = id(new PhabricatorApplicationTransactionCommentView())
- ->setUser($viewer)
- ->setObjectPHID($post->getPHID())
- ->setDraft($draft)
- ->setHeaderText(pht('Add Comment'))
- ->setAction($this->getApplicationURI('post/comment/'.$post->getID().'/'))
- ->setSubmitButtonName(pht('Add Comment'));
+ $box = id(new PhamePostEditEngine())
+ ->setViewer($viewer)
+ ->buildEditEngineCommentView($post)
+ ->setTransactionTimeline($timeline);
return phutil_tag_div('phui-document-view-pro-box', $box);
}
diff --git a/src/applications/phame/editor/PhamePostEditEngine.php b/src/applications/phame/editor/PhamePostEditEngine.php
--- a/src/applications/phame/editor/PhamePostEditEngine.php
+++ b/src/applications/phame/editor/PhamePostEditEngine.php
@@ -68,6 +68,10 @@
return $object->getViewURI();
}
+ protected function getEditorURI() {
+ return $this->getApplication()->getApplicationURI('post/edit/');
+ }
+
protected function buildCustomEditFields($object) {
$blog_phid = $object->getBlog()->getPHID();
diff --git a/src/applications/phame/mail/PhamePostMailReceiver.php b/src/applications/phame/mail/PhamePostMailReceiver.php
--- a/src/applications/phame/mail/PhamePostMailReceiver.php
+++ b/src/applications/phame/mail/PhamePostMailReceiver.php
@@ -9,7 +9,7 @@
}
protected function getObjectPattern() {
- return 'POST[1-9]\d*';
+ return 'J[1-9]\d*';
}
protected function loadObject($pattern, PhabricatorUser $viewer) {
diff --git a/src/applications/phame/phid/PhabricatorPhamePostPHIDType.php b/src/applications/phame/phid/PhabricatorPhamePostPHIDType.php
--- a/src/applications/phame/phid/PhabricatorPhamePostPHIDType.php
+++ b/src/applications/phame/phid/PhabricatorPhamePostPHIDType.php
@@ -32,8 +32,8 @@
foreach ($handles as $phid => $handle) {
$post = $objects[$phid];
$handle->setName($post->getTitle());
- $handle->setFullName($post->getTitle());
- $handle->setURI('/phame/post/view/'.$post->getID().'/');
+ $handle->setFullName(pht('Blog Post: ').$post->getTitle());
+ $handle->setURI('/J'.$post->getID());
if ($post->isArchived()) {
$handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED);
diff --git a/src/applications/phame/remarkup/PhamePostRemarkupRule.php b/src/applications/phame/remarkup/PhamePostRemarkupRule.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phame/remarkup/PhamePostRemarkupRule.php
@@ -0,0 +1,19 @@
+<?php
+
+final class PhamePostRemarkupRule
+ extends PhabricatorObjectRemarkupRule {
+
+ protected function getObjectNamePrefix() {
+ return 'J';
+ }
+
+ protected function loadObjects(array $ids) {
+ $viewer = $this->getEngine()->getConfig('viewer');
+
+ return id(new PhamePostQuery())
+ ->setViewer($viewer)
+ ->withIDs($ids)
+ ->execute();
+ }
+
+}
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
@@ -51,6 +51,10 @@
return $this->assertAttached($this->blog);
}
+ public function getMonogram() {
+ return 'J'.$this->getID();
+ }
+
public function getLiveURI() {
$blog = $this->getBlog();
$is_draft = $this->isDraft();
diff --git a/webroot/rsrc/css/application/phame/phame.css b/webroot/rsrc/css/application/phame/phame.css
--- a/webroot/rsrc/css/application/phame/phame.css
+++ b/webroot/rsrc/css/application/phame/phame.css
@@ -308,3 +308,7 @@
font-family: 'Aleo', {$fontfamily};
padding-top: 8px;
}
+
+.phame-comment-view .aphront-form-control.aphront-form-control-select {
+ display: none;
+}

File Metadata

Mime Type
text/plain
Expires
Thu, May 9, 8:18 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6276589
Default Alt Text
D16222.diff (12 KB)

Event Timeline