EBernhardson (WMF) has uploaded a new change for review. https://gerrit.wikimedia.org/r/87291
Change subject: Allow querying of summary content via api ...................................................................... Allow querying of summary content via api Change-Id: I9e67f01acfed8adf57a8d6c61edf8343dc161dde --- M includes/Model/Summary.php M includes/api/ApiQueryRevisionContentFlow.php M modules/summary/summary.js M templates/edit-summary.html.php 4 files changed, 17 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/91/87291/1 diff --git a/includes/Model/Summary.php b/includes/Model/Summary.php index ffb65a1..cd511af 100644 --- a/includes/Model/Summary.php +++ b/includes/Model/Summary.php @@ -35,5 +35,9 @@ public function getRevisionType() { return 'summary'; } + + public function getWorkflowId() { + return $this->workflowId; + } } diff --git a/includes/api/ApiQueryRevisionContentFlow.php b/includes/api/ApiQueryRevisionContentFlow.php index c5c6df3..5edec47 100644 --- a/includes/api/ApiQueryRevisionContentFlow.php +++ b/includes/api/ApiQueryRevisionContentFlow.php @@ -4,6 +4,12 @@ use Flow\Container; class ApiQueryRevisionContentFlow extends ApiQueryBase { + + private static $repos = array( + 'Post' => 'tree_rev_descendant_id', + 'Summary' => 'summary_workflow_id', + ); + public function __construct( $query, $moduleName ) { parent::__construct( $query, $moduleName, 'rev' ); } @@ -12,6 +18,9 @@ $params = $this->extractRequestParams(); $container = Container::getContainer(); + if ( !isset( self::$repos[$params['container']] ) ) { + throw new MWException( 'Unknown content type: ' . $params['container'] ); + } $storage = $container['storage']->getStorage( $params['container'] ); $id = UUID::create( $params['id'] ); @@ -19,7 +28,7 @@ if ( $id ) { $post = $storage->find( - array( 'tree_rev_descendant_id' => $id->getBinary() ), + array( self::$repos[$params['container']] => $id->getBinary() ), array( 'sort' => 'rev_id', 'order' => 'DESC', 'limit' => 1 ) ); } diff --git a/modules/summary/summary.js b/modules/summary/summary.js index 4588c42..dfd41a3 100644 --- a/modules/summary/summary.js +++ b/modules/summary/summary.js @@ -6,7 +6,7 @@ $textarea = $form.find( 'textarea' ); // convert text-area into editor - mw.flow.editor.load( $textarea, $textarea.data( 'summary-id' ), 'Summary' ); + mw.flow.editor.load( $textarea, $textarea.data( 'workflow-id' ), 'Summary' ); // when submitting the form, grab the editor's content $form.submit( function () { diff --git a/templates/edit-summary.html.php b/templates/edit-summary.html.php index c2a0f8c..d044e6b 100644 --- a/templates/edit-summary.html.php +++ b/templates/edit-summary.html.php @@ -25,7 +25,8 @@ $block->getName() . '[content]', $summary ? $summary->getContent( $user, 'wikitext' ) : '', array( - 'data-summary-id' => $summary ? $summary->getRevisionId()->getHex() : '' + 'data-workflow-id' => $summary ? $summary->getWorkflowId()->getHex() : '', + 'data-summary-id' => $summary ? $summary->getRevisionId()->getHex() : '', ) ); echo Html::element( 'input', array( -- To view, visit https://gerrit.wikimedia.org/r/87291 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9e67f01acfed8adf57a8d6c61edf8343dc161dde Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: EBernhardson (WMF) <ebernhard...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits