EBernhardson (WMF) has submitted this change and it was merged.
Change subject: edit-post action for Topic block
..
edit-post action for Topic block
Includes some refactoring of Parsoid, and a few other unrelated changes.
Change-Id: Ie62ff67ae09ec131ae49acce3ffe779311203842
---
M Flow.i18n.php
M Flow.php
M includes/Block/Topic.php
M includes/Block/TopicList.php
M includes/Model/PostRevision.php
M includes/Model/UUID.php
M includes/Model/Workflow.php
A includes/ParsoidUtils.php
M includes/Templating.php
M includes/UrlGenerator.php
M includes/api/ApiQueryFlow.php
M modules/base/ext.flow.base.js
M modules/discussion/base.css
M modules/discussion/discussion.js
A templates/edit-post.html.php
M templates/post.html.php
M templates/topic.html.php
17 files changed, 502 insertions(+), 117 deletions(-)
Approvals:
EBernhardson (WMF): Verified; Looks good to me, approved
diff --git a/Flow.i18n.php b/Flow.i18n.php
index 38844e0..2914ba7 100644
--- a/Flow.i18n.php
+++ b/Flow.i18n.php
@@ -29,7 +29,13 @@
'flow-reply-placeholder' = 'Click to reply to $1. Be nice!',
'flow-reply-submit' = 'Post Reply',
+ 'flow-edit-post-submit' = 'Submit changes',
+
+ 'flow-post-action-view' = 'Permalink',
+ 'flow-post-action-post-history' = 'Post history',
'flow-post-action-delete-post' = 'Delete post',
+ 'flow-post-action-edit-post' = 'Edit post',
+ 'flow-post-action-edit' = 'Edit',
'flow-post-action-restore-post' = 'Restore post',
'flow-topic-action-edit-title' = 'Edit Title',
diff --git a/Flow.php b/Flow.php
index 2ba0fee..10508c5 100755
--- a/Flow.php
+++ b/Flow.php
@@ -40,7 +40,7 @@
'descriptionmsg' = 'flow-desc',
);
-$dir = dirname( __FILE__ ) . '/';
+$dir = __DIR__ . '/';
$wgExtensionMessagesFiles['Flow'] = $dir . 'Flow.i18n.php';
// Classes fulfilling the mediawiki extension architecture
@@ -51,6 +51,7 @@
$wgAutoloadClasses['Pimple'] = $dir . 'vendor/Pimple.php';
$wgAutoloadClasses['Flow\Container'] = $dir . 'includes/Container.php';
$wgAutoloadClasses['Flow\DbFactory'] = $dir . 'includes/DbFactory.php';
+$wgAutoloadClasses['Flow\ParsoidUtils'] = $dir . 'includes/ParsoidUtils.php';
$wgAutoloadClasses['Flow\Templating'] = $dir . 'includes/Templating.php';
$wgAutoloadClasses['Flow\UrlGenerator'] = $dir . 'includes/UrlGenerator.php';
$wgAutoloadClasses['Flow\WorkflowLoader'] = $dir .
'includes/WorkflowLoader.php';
@@ -158,6 +159,7 @@
'flow-error-external',
'flow-error-external-multi',
'flow-edit-title-submit',
+ 'flow-edit-post-submit',
),
),
);
@@ -190,6 +192,6 @@
$wgFlowUseParsoid = false;
$wgFlowParsoidURL = 'http://localhost:8000';
-$wgFlowParsoidPrefix = '_wikitext';
+$wgFlowParsoidPrefix = 'localhost';
$wgFlowParsoidTimeout = 100;
diff --git a/includes/Block/Topic.php b/includes/Block/Topic.php
index 59f5a9b..66ddb02 100644
--- a/includes/Block/Topic.php
+++ b/includes/Block/Topic.php
@@ -8,6 +8,7 @@
use Flow\Data\ManagerGroup;
use Flow\Data\RootPostLoader;
use Flow\DbFactory;
+use Flow\ParsoidUtils;
use Flow\Templating;
use User;
@@ -17,8 +18,12 @@
protected $topicTitle;
protected $rootLoader;
protected $newRevision;
+ protected $requestedPost;
- protected $supportedActions = array( 'edit-title', 'reply',
'delete-topic', 'delete-post', 'restore-post' );
+ protected $supportedActions = array(
+ 'edit-post', 'delete-post', 'restore-post',
+ 'reply', 'delete-topic',
+ );
public function __construct( Workflow $workflow, ManagerGroup $storage,
$root ) {
parent::__construct( $workflow, $storage );
@@ -56,6 +61,10 @@
$this-validateRestorePost();
break;
+ case 'edit-post':
+ $this-validateEditPost();
+ break;
+
default:
throw new \MWException( Unexpected action:
{$this-action} );
}
@@ -80,7 +89,7 @@
if ( empty( $this-submitted['content'] ) ) {
$this-errors['content'] = wfMessage(
'flow-error-missing-content' );
} else {
- $this-parsedContent = $this-convertWikitextToHtml5(
$this-submitted['content'] );
+ $this-parsedContent =
ParsoidUtils::convertWikitextToHtml5( $this-submitted['content'],
$this-workflow-getArticleTitle() );
if ( empty( $this-parsedContent ) ) {
$this-errors['content'] = wfMessage(
'flow-error-parsoid-failure' );
}
@@ -153,45 +162,25 @@
}
}
- // @todo: I assume not only topic reply, but also TopicListBlock
SummaryBlock's content need to