Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15431786
D21709.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D21709.id.diff
View Options
diff --git a/src/applications/phriction/controller/PhrictionMarkupPreviewController.php b/src/applications/phriction/controller/PhrictionMarkupPreviewController.php
--- a/src/applications/phriction/controller/PhrictionMarkupPreviewController.php
+++ b/src/applications/phriction/controller/PhrictionMarkupPreviewController.php
@@ -3,13 +3,30 @@
final class PhrictionMarkupPreviewController
extends PhabricatorController {
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
$text = $request->getStr('text');
$slug = $request->getStr('slug');
+ $document = id(new PhrictionDocumentQuery())
+ ->setViewer($viewer)
+ ->withSlugs(array($slug))
+ ->needContent(true)
+ ->executeOne();
+ if (!$document) {
+ $document = PhrictionDocument::initializeNewDocument(
+ $viewer,
+ $slug);
+
+ $content = id(new PhrictionContent())
+ ->setSlug($slug);
+
+ $document
+ ->setPHID($document->generatePHID())
+ ->attachContent($content);
+ }
+
$output = PhabricatorMarkupEngine::renderOneObject(
id(new PhabricatorMarkupOneOff())
->setPreserveLinebreaks(true)
@@ -17,10 +34,7 @@
->setContent($text),
'default',
$viewer,
- array(
- 'phriction.isPreview' => true,
- 'phriction.slug' => $slug,
- ));
+ $document);
return id(new AphrontAjaxResponse())
->setContent($output);
diff --git a/src/applications/phriction/markup/PhrictionRemarkupRule.php b/src/applications/phriction/markup/PhrictionRemarkupRule.php
--- a/src/applications/phriction/markup/PhrictionRemarkupRule.php
+++ b/src/applications/phriction/markup/PhrictionRemarkupRule.php
@@ -273,13 +273,6 @@
return null;
}
- // Handle content when it's a preview for the Phriction editor.
- if (is_array($context)) {
- if (idx($context, 'phriction.isPreview')) {
- return idx($context, 'phriction.slug');
- }
- }
-
if ($context instanceof PhrictionContent) {
return $context->getSlug();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 25, 2:31 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7309014
Default Alt Text
D21709.id.diff (2 KB)
Attached To
Mode
D21709: Pass a real context object to Phriction previews, fixing mentions
Attached
Detach File
Event Timeline
Log In to Comment