Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13190858
D14642.id35424.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D14642.id35424.diff
View Options
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
@@ -3331,6 +3331,7 @@
'PhamePostMailReceiver' => 'applications/phame/mail/PhamePostMailReceiver.php',
'PhamePostNewController' => 'applications/phame/controller/post/PhamePostNewController.php',
'PhamePostNotLiveController' => 'applications/phame/controller/post/PhamePostNotLiveController.php',
+ 'PhamePostPreviewController' => 'applications/phame/controller/post/PhamePostPreviewController.php',
'PhamePostPublishController' => 'applications/phame/controller/post/PhamePostPublishController.php',
'PhamePostQuery' => 'applications/phame/query/PhamePostQuery.php',
'PhamePostReplyHandler' => 'applications/phame/mail/PhamePostReplyHandler.php',
@@ -7670,6 +7671,7 @@
'PhamePostMailReceiver' => 'PhabricatorObjectMailReceiver',
'PhamePostNewController' => 'PhamePostController',
'PhamePostNotLiveController' => 'PhamePostController',
+ 'PhamePostPreviewController' => 'PhamePostController',
'PhamePostPublishController' => 'PhamePostController',
'PhamePostQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhamePostReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
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
@@ -47,6 +47,7 @@
'edit/(?:(?P<id>[^/]+)/)?' => 'PhamePostEditController',
'view/(?P<id>\d+)/' => 'PhamePostViewController',
'publish/(?P<id>\d+)/' => 'PhamePostPublishController',
+ 'preview/(?P<id>\d+)/' => 'PhamePostPreviewController',
'unpublish/(?P<id>\d+)/' => 'PhamePostUnpublishController',
'notlive/(?P<id>\d+)/' => 'PhamePostNotLiveController',
'preview/' => 'PhabricatorMarkupPreviewController',
diff --git a/src/applications/phame/controller/post/PhamePostPublishController.php b/src/applications/phame/controller/post/PhamePostPreviewController.php
copy from src/applications/phame/controller/post/PhamePostPublishController.php
copy to src/applications/phame/controller/post/PhamePostPreviewController.php
--- a/src/applications/phame/controller/post/PhamePostPublishController.php
+++ b/src/applications/phame/controller/post/PhamePostPreviewController.php
@@ -1,6 +1,6 @@
<?php
-final class PhamePostPublishController extends PhamePostController {
+final class PhamePostPreviewController extends PhamePostController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
@@ -49,8 +49,13 @@
->setHeaderText(pht('Preview Post'))
->setForm($form);
+ $blog = $post->getBlog();
+
$crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb(pht('Preview'), $view_uri);
+ $crumbs->addTextCrumb(
+ $blog->getName(),
+ $this->getApplicationURI('blog/view/'.$blog->getID().'/'));
+ $crumbs->addTextCrumb(pht('Preview Post'), $view_uri);
return $this->newPage()
->setTitle(pht('Preview Post'))
@@ -72,7 +77,7 @@
phutil_tag(
'iframe',
array(
- 'style' => 'width: 100%; height: 600px; '.
+ 'style' => 'width: 100%; height: 800px; '.
'border: 1px solid #BFCFDA; '.
'background-color: #fff; '.
'border-radius: 3px; ',
diff --git a/src/applications/phame/controller/post/PhamePostPublishController.php b/src/applications/phame/controller/post/PhamePostPublishController.php
--- a/src/applications/phame/controller/post/PhamePostPublishController.php
+++ b/src/applications/phame/controller/post/PhamePostPublishController.php
@@ -18,8 +18,6 @@
return new Aphront404Response();
}
- $view_uri = $this->getApplicationURI('/post/view/'.$post->getID().'/');
-
if ($request->isFormPost()) {
$xactions = array();
$xactions[] = id(new PhamePostTransaction())
@@ -33,52 +31,22 @@
->setContinueOnMissingFields(true)
->applyTransactions($post, $xactions);
- return id(new AphrontRedirectResponse())->setURI($view_uri);
+ return id(new AphrontRedirectResponse())
+ ->setURI($this->getApplicationURI('/post/view/'.$post->getID().'/'));
}
- $form = id(new AphrontFormView())
- ->setUser($viewer)
- ->appendChild(
- id(new AphrontFormSubmitControl())
- ->setValue(pht('Publish Post'))
- ->addCancelButton($view_uri));
-
- $frame = $this->renderPreviewFrame($post);
-
- $form_box = id(new PHUIObjectBoxView())
- ->setHeaderText(pht('Preview Post'))
- ->setForm($form);
-
- $crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb(pht('Preview'), $view_uri);
+ $cancel_uri = $this->getApplicationURI('/post/view/'.$post->getID().'/');
- return $this->newPage()
- ->setTitle(pht('Preview Post'))
- ->setCrumbs($crumbs)
+ $dialog = $this->newDialog()
+ ->setTitle(pht('Publish Post?'))
->appendChild(
- array(
- $form_box,
- $frame,
- ));
- }
+ pht(
+ 'The post "%s" will go live once you publish it.',
+ $post->getTitle()))
+ ->addSubmitButton(pht('Publish'))
+ ->addCancelButton($cancel_uri);
- private function renderPreviewFrame(PhamePost $post) {
-
- return phutil_tag(
- 'div',
- array(
- 'style' => 'text-align: center; padding: 16px;',
- ),
- phutil_tag(
- 'iframe',
- array(
- 'style' => 'width: 100%; height: 600px; '.
- 'border: 1px solid #BFCFDA; '.
- 'background-color: #fff; '.
- 'border-radius: 3px; ',
- 'src' => $this->getApplicationURI('/post/framed/'.$post->getID().'/'),
- ),
- ''));
+ return id(new AphrontDialogResponse())->setDialog($dialog);
}
}
diff --git a/src/applications/phame/controller/post/PhamePostUnpublishController.php b/src/applications/phame/controller/post/PhamePostUnpublishController.php
--- a/src/applications/phame/controller/post/PhamePostUnpublishController.php
+++ b/src/applications/phame/controller/post/PhamePostUnpublishController.php
@@ -37,8 +37,7 @@
$cancel_uri = $this->getApplicationURI('/post/view/'.$post->getID().'/');
- $dialog = id(new AphrontDialogView())
- ->setUser($viewer)
+ $dialog = $this->newDialog()
->setTitle(pht('Unpublish Post?'))
->appendChild(
pht(
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
@@ -63,7 +63,7 @@
->appendChild(
pht(
'Only you can see this draft until you publish it. '.
- 'Use "Preview / Publish" to publish this post.')));
+ 'Use "Preview or Publish" to publish this post.')));
}
if (!$post->getBlog()) {
@@ -150,7 +150,14 @@
->setIcon('fa-eye')
->setHref($this->getApplicationURI('post/publish/'.$id.'/'))
->setDisabled(!$can_edit)
- ->setName(pht('Preview / Publish')));
+ ->setName(pht('Publish'))
+ ->setWorkflow(true));
+ $actions->addAction(
+ id(new PhabricatorActionView())
+ ->setIcon('fa-eye')
+ ->setHref($this->getApplicationURI('post/preview/'.$id.'/'))
+ ->setDisabled(!$can_edit)
+ ->setName(pht('Preview in Skin')));
} else {
$actions->addAction(
id(new PhabricatorActionView())
diff --git a/src/applications/phame/editor/PhamePostEditor.php b/src/applications/phame/editor/PhamePostEditor.php
--- a/src/applications/phame/editor/PhamePostEditor.php
+++ b/src/applications/phame/editor/PhamePostEditor.php
@@ -209,8 +209,21 @@
$body = parent::buildMailBody($object, $xactions);
+ // We don't send mail if the object is a draft, and we only want
+ // to include the full body of the post on the either the
+ // first creation or if it was created as a draft, once it goes live.
if ($this->getIsNewObject()) {
$body->addRemarkupSection(null, $object->getBody());
+ } else {
+ foreach ($xactions as $xaction) {
+ switch ($xaction->getTransactionType()) {
+ case PhamePostTransaction::TYPE_VISIBILITY:
+ if (!$object->isDraft()) {
+ $body->addRemarkupSection(null, $object->getBody());
+ }
+ break;
+ }
+ }
}
$body->addLinkSection(
diff --git a/src/applications/phame/storage/PhamePostTransaction.php b/src/applications/phame/storage/PhamePostTransaction.php
--- a/src/applications/phame/storage/PhamePostTransaction.php
+++ b/src/applications/phame/storage/PhamePostTransaction.php
@@ -206,10 +206,7 @@
}
if (strlen($text)) {
- return phutil_escape_html_newlines(
- id(new PhutilUTF8StringTruncator())
- ->setMaximumGlyphs(128)
- ->truncateString($text));
+ return PhabricatorMarkupEngine::summarize($text);
}
return parent::getBodyForFeed($story);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 12, 2:40 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6291393
Default Alt Text
D14642.id35424.diff (9 KB)
Attached To
Mode
D14642: Clean up Phame Preview
Attached
Detach File
Event Timeline
Log In to Comment