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

Use CommentEditEngine in PhamePost

Summary:
Ref T9360. Moves PhamePost to CommentEditEngine.

[x] HTTP Parameters dropdown on New Post goes to 404
[x] Implement EditEngine Comments

Test Plan: Make Post, Make Comment, Laugh.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9360

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

+60 -88
+2 -2
resources/celerity/map.php
··· 81 81 'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b', 82 82 'rsrc/css/application/paste/paste.css' => '1898e534', 83 83 'rsrc/css/application/people/people-profile.css' => '2473d929', 84 - 'rsrc/css/application/phame/phame.css' => 'bf6a743f', 84 + 'rsrc/css/application/phame/phame.css' => '8efb0729', 85 85 'rsrc/css/application/pholio/pholio-edit.css' => '07676f51', 86 86 'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49', 87 87 'rsrc/css/application/pholio/pholio.css' => 'ca89d380', ··· 811 811 'phabricator-uiexample-reactor-sendclass' => '1def2711', 812 812 'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee', 813 813 'phabricator-zindex-css' => '5b6fcf3f', 814 - 'phame-css' => 'bf6a743f', 814 + 'phame-css' => '8efb0729', 815 815 'pholio-css' => 'ca89d380', 816 816 'pholio-edit-css' => '07676f51', 817 817 'pholio-inline-comments-css' => '8e545e49',
+2 -2
src/__phutil_library_map__.php
··· 3834 3834 'PhameNextPostView' => 'applications/phame/view/PhameNextPostView.php', 3835 3835 'PhamePost' => 'applications/phame/storage/PhamePost.php', 3836 3836 'PhamePostArchiveController' => 'applications/phame/controller/post/PhamePostArchiveController.php', 3837 - 'PhamePostCommentController' => 'applications/phame/controller/post/PhamePostCommentController.php', 3838 3837 'PhamePostController' => 'applications/phame/controller/post/PhamePostController.php', 3839 3838 'PhamePostEditConduitAPIMethod' => 'applications/phame/conduit/PhamePostEditConduitAPIMethod.php', 3840 3839 'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php', ··· 3848 3847 'PhamePostMoveController' => 'applications/phame/controller/post/PhamePostMoveController.php', 3849 3848 'PhamePostPublishController' => 'applications/phame/controller/post/PhamePostPublishController.php', 3850 3849 'PhamePostQuery' => 'applications/phame/query/PhamePostQuery.php', 3850 + 'PhamePostRemarkupRule' => 'applications/phame/remarkup/PhamePostRemarkupRule.php', 3851 3851 'PhamePostReplyHandler' => 'applications/phame/mail/PhamePostReplyHandler.php', 3852 3852 'PhamePostSearchConduitAPIMethod' => 'applications/phame/conduit/PhamePostSearchConduitAPIMethod.php', 3853 3853 'PhamePostSearchEngine' => 'applications/phame/query/PhamePostSearchEngine.php', ··· 8760 8760 'PhabricatorFulltextInterface', 8761 8761 ), 8762 8762 'PhamePostArchiveController' => 'PhamePostController', 8763 - 'PhamePostCommentController' => 'PhamePostController', 8764 8763 'PhamePostController' => 'PhameController', 8765 8764 'PhamePostEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 8766 8765 'PhamePostEditController' => 'PhamePostController', ··· 8774 8773 'PhamePostMoveController' => 'PhamePostController', 8775 8774 'PhamePostPublishController' => 'PhamePostController', 8776 8775 'PhamePostQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 8776 + 'PhamePostRemarkupRule' => 'PhabricatorObjectRemarkupRule', 8777 8777 'PhamePostReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 8778 8778 'PhamePostSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 8779 8779 'PhamePostSearchEngine' => 'PhabricatorApplicationSearchEngine',
+11 -4
src/applications/phame/application/PhabricatorPhameApplication.php
··· 37 37 38 38 public function getRoutes() { 39 39 return array( 40 - '/phame/' => array( 40 + '/J(?P<id>[1-9]\d*)' => 'PhamePostViewController', 41 + '/phame/' => array( 41 42 '' => 'PhameHomeController', 42 43 43 44 // NOTE: The live routes include an initial "/", so leave it off ··· 46 47 'post/' => array( 47 48 '(?:query/(?P<queryKey>[^/]+)/)?' => 'PhamePostListController', 48 49 'blogger/(?P<bloggername>[\w\.-_]+)/' => 'PhamePostListController', 49 - 'edit/(?:(?P<id>[^/]+)/)?' => 'PhamePostEditController', 50 + $this->getEditRoutePattern('edit/') 51 + => 'PhamePostEditController', 50 52 'history/(?P<id>\d+)/' => 'PhamePostHistoryController', 51 53 'view/(?P<id>\d+)/(?:(?P<slug>[^/]+)/)?' => 'PhamePostViewController', 52 54 '(?P<action>publish|unpublish)/(?P<id>\d+)/' 53 55 => 'PhamePostPublishController', 54 56 'preview/(?P<id>\d+)/' => 'PhamePostPreviewController', 55 57 'preview/' => 'PhabricatorMarkupPreviewController', 56 - 'framed/(?P<id>\d+)/' => 'PhamePostFramedController', 57 58 'move/(?P<id>\d+)/' => 'PhamePostMoveController', 58 59 'archive/(?P<id>\d+)/' => 'PhamePostArchiveController', 59 - 'comment/(?P<id>[1-9]\d*)/' => 'PhamePostCommentController', 60 60 ), 61 61 'blog/' => array( 62 62 '(?:query/(?P<queryKey>[^/]+)/)?' => 'PhameBlogListController', ··· 106 106 '/phame/live/.*', 107 107 ); 108 108 } 109 + 110 + public function getRemarkupRules() { 111 + return array( 112 + new PhamePostRemarkupRule(), 113 + ); 114 + } 115 + 109 116 110 117 protected function getCustomCapabilities() { 111 118 return array(
-63
src/applications/phame/controller/post/PhamePostCommentController.php
··· 1 - <?php 2 - 3 - final class PhamePostCommentController 4 - extends PhamePostController { 5 - 6 - public function handleRequest(AphrontRequest $request) { 7 - $viewer = $request->getViewer(); 8 - $id = $request->getURIData('id'); 9 - 10 - if (!$request->isFormPost()) { 11 - return new Aphront400Response(); 12 - } 13 - 14 - $post = id(new PhamePostQuery()) 15 - ->setViewer($viewer) 16 - ->withIDs(array($id)) 17 - ->executeOne(); 18 - if (!$post) { 19 - return new Aphront404Response(); 20 - } 21 - 22 - $is_preview = $request->isPreviewRequest(); 23 - $draft = PhabricatorDraft::buildFromRequest($request); 24 - 25 - $view_uri = $this->getApplicationURI('post/view/'.$post->getID().'/'); 26 - 27 - $xactions = array(); 28 - $xactions[] = id(new PhamePostTransaction()) 29 - ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) 30 - ->attachComment( 31 - id(new PhamePostTransactionComment()) 32 - ->setContent($request->getStr('comment'))); 33 - 34 - $editor = id(new PhamePostEditor()) 35 - ->setActor($viewer) 36 - ->setContinueOnNoEffect($request->isContinueRequest()) 37 - ->setContentSourceFromRequest($request) 38 - ->setIsPreview($is_preview); 39 - 40 - try { 41 - $xactions = $editor->applyTransactions($post, $xactions); 42 - } catch (PhabricatorApplicationTransactionNoEffectException $ex) { 43 - return id(new PhabricatorApplicationTransactionNoEffectResponse()) 44 - ->setCancelURI($view_uri) 45 - ->setException($ex); 46 - } 47 - 48 - if ($draft) { 49 - $draft->replaceOrDelete(); 50 - } 51 - 52 - if ($request->isAjax() && $is_preview) { 53 - return id(new PhabricatorApplicationTransactionResponse()) 54 - ->setViewer($viewer) 55 - ->setTransactions($xactions) 56 - ->setIsPreview($is_preview); 57 - } else { 58 - return id(new AphrontRedirectResponse()) 59 - ->setURI($view_uri); 60 - } 61 - } 62 - 63 - }
+11 -14
src/applications/phame/controller/post/PhamePostViewController.php
··· 123 123 ->setImage($blogger->getProfileImageURI()) 124 124 ->setImageHref($author_uri); 125 125 126 + $monogram = $post->getMonogram(); 126 127 $timeline = $this->buildTransactionTimeline( 127 128 $post, 128 129 id(new PhamePostTransactionQuery()) 129 130 ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); 130 - $timeline = phutil_tag_div('phui-document-view-pro-box', $timeline); 131 + $timeline->setQuoteRef($monogram); 131 132 132 133 if ($is_external) { 133 134 $add_comment = null; 134 135 } else { 135 - $add_comment = $this->buildCommentForm($post); 136 - $add_comment = phutil_tag_div('mlb mlt', $add_comment); 136 + $add_comment = $this->buildCommentForm($post, $timeline); 137 + $add_comment = phutil_tag_div('mlb mlt phame-comment-view', $add_comment); 137 138 } 139 + 140 + $timeline = phutil_tag_div('phui-document-view-pro-box', $timeline); 138 141 139 142 list($prev, $next) = $this->loadAdjacentPosts($post); 140 143 ··· 273 276 return $actions; 274 277 } 275 278 276 - private function buildCommentForm(PhamePost $post) { 279 + private function buildCommentForm(PhamePost $post, $timeline) { 277 280 $viewer = $this->getViewer(); 278 281 279 - $draft = PhabricatorDraft::newFromUserAndKey( 280 - $viewer, $post->getPHID()); 281 - 282 - $box = id(new PhabricatorApplicationTransactionCommentView()) 283 - ->setUser($viewer) 284 - ->setObjectPHID($post->getPHID()) 285 - ->setDraft($draft) 286 - ->setHeaderText(pht('Add Comment')) 287 - ->setAction($this->getApplicationURI('post/comment/'.$post->getID().'/')) 288 - ->setSubmitButtonName(pht('Add Comment')); 282 + $box = id(new PhamePostEditEngine()) 283 + ->setViewer($viewer) 284 + ->buildEditEngineCommentView($post) 285 + ->setTransactionTimeline($timeline); 289 286 290 287 return phutil_tag_div('phui-document-view-pro-box', $box); 291 288 }
+4
src/applications/phame/editor/PhamePostEditEngine.php
··· 68 68 return $object->getViewURI(); 69 69 } 70 70 71 + protected function getEditorURI() { 72 + return $this->getApplication()->getApplicationURI('post/edit/'); 73 + } 74 + 71 75 protected function buildCustomEditFields($object) { 72 76 $blog_phid = $object->getBlog()->getPHID(); 73 77
+1 -1
src/applications/phame/mail/PhamePostMailReceiver.php
··· 9 9 } 10 10 11 11 protected function getObjectPattern() { 12 - return 'POST[1-9]\d*'; 12 + return 'J[1-9]\d*'; 13 13 } 14 14 15 15 protected function loadObject($pattern, PhabricatorUser $viewer) {
+2 -2
src/applications/phame/phid/PhabricatorPhamePostPHIDType.php
··· 32 32 foreach ($handles as $phid => $handle) { 33 33 $post = $objects[$phid]; 34 34 $handle->setName($post->getTitle()); 35 - $handle->setFullName($post->getTitle()); 36 - $handle->setURI('/phame/post/view/'.$post->getID().'/'); 35 + $handle->setFullName(pht('Blog Post: ').$post->getTitle()); 36 + $handle->setURI('/J'.$post->getID()); 37 37 38 38 if ($post->isArchived()) { 39 39 $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED);
+19
src/applications/phame/remarkup/PhamePostRemarkupRule.php
··· 1 + <?php 2 + 3 + final class PhamePostRemarkupRule 4 + extends PhabricatorObjectRemarkupRule { 5 + 6 + protected function getObjectNamePrefix() { 7 + return 'J'; 8 + } 9 + 10 + protected function loadObjects(array $ids) { 11 + $viewer = $this->getEngine()->getConfig('viewer'); 12 + 13 + return id(new PhamePostQuery()) 14 + ->setViewer($viewer) 15 + ->withIDs($ids) 16 + ->execute(); 17 + } 18 + 19 + }
+4
src/applications/phame/storage/PhamePost.php
··· 51 51 return $this->assertAttached($this->blog); 52 52 } 53 53 54 + public function getMonogram() { 55 + return 'J'.$this->getID(); 56 + } 57 + 54 58 public function getLiveURI() { 55 59 $blog = $this->getBlog(); 56 60 $is_draft = $this->isDraft();
+4
webroot/rsrc/css/application/phame/phame.css
··· 308 308 font-family: 'Aleo', {$fontfamily}; 309 309 padding-top: 8px; 310 310 } 311 + 312 + .phame-comment-view .aphront-form-control.aphront-form-control-select { 313 + display: none; 314 + }