jenkins-bot has submitted this change and it was merged.
Change subject: Remove redundant $template var from block renderAPI() method
......................................................................
Remove redundant $template var from block renderAPI() method
It's no longer needed since the frontend rewrite
Change-Id: Ia0a1071fc8ac9e3fa651a4645bd8a58101b1de83
---
M includes/Block/Block.php
M includes/Block/BoardHistory.php
M includes/Block/Header.php
M includes/Block/Topic.php
M includes/Block/TopicList.php
M includes/Block/TopicSummary.php
M includes/View.php
M includes/api/ApiFlowBaseGet.php
M includes/api/ApiFlowBasePost.php
M includes/api/ApiQueryFlow.php
10 files changed, 19 insertions(+), 25 deletions(-)
Approvals:
EBernhardson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Block/Block.php b/includes/Block/Block.php
index b3584f4..3bf6a78 100644
--- a/includes/Block/Block.php
+++ b/includes/Block/Block.php
@@ -33,11 +33,10 @@
* Render the API output of this Block.
* Templating is provided for convenience
*
- * @param Templating $templating
* @param array $options
* @return array
*/
- function renderAPI( Templating $templating, array $options );
+ function renderAPI( array $options );
/**
* @return string Unique name among all blocks on an object
@@ -90,7 +89,6 @@
// These methods exist in the Block interface and as such cannot be
abstract
// until php 5.3.9, but MediaWiki requires PHP version 5.3.2 or later
(and
// some of our test machines are on 5.3.3).
- //abstract public function renderAPI( Templating $templating, array
$options );
//abstract public function commit();
public function init( $action, $user ) {
diff --git a/includes/Block/BoardHistory.php b/includes/Block/BoardHistory.php
index a8c2f52..d0fb24a 100644
--- a/includes/Block/BoardHistory.php
+++ b/includes/Block/BoardHistory.php
@@ -40,7 +40,7 @@
throw new DataModelException( __CLASS__ . ' should not invoke
commit()', 'process-data' );
}
- public function renderAPI( Templating $templating, array $options ) {
+ public function renderAPI( array $options ) {
if ( $this->workflow->isNew() ) {
return array(
'type' => $this->getName(),
diff --git a/includes/Block/Header.php b/includes/Block/Header.php
index 09b7ce0..51f899b 100644
--- a/includes/Block/Header.php
+++ b/includes/Block/Header.php
@@ -169,7 +169,7 @@
}
}
- public function renderAPI( Templating $templating, array $options ) {
+ public function renderAPI( array $options ) {
$output = array(
'type' => $this->getName(),
'editToken' => $this->getEditToken(),
diff --git a/includes/Block/Topic.php b/includes/Block/Topic.php
index 005c5a6..fe104d7 100644
--- a/includes/Block/Topic.php
+++ b/includes/Block/Topic.php
@@ -444,7 +444,7 @@
}
}
- public function renderAPI( Templating $templating, array $options ) {
+ public function renderAPI( array $options ) {
$topic = $this->loadTopicTitle( $this->action === 'history' ?
'history' : 'view' );
if ( !$topic ) {
throw new PermissionException( 'Not Allowed',
'insufficient-permission' );
@@ -457,10 +457,10 @@
// single post history or full topic?
if ( isset( $options['postId'] ) ) {
// singular post history
- $output = $this->renderPostHistoryAPI(
$templating, $options, UUID::create( $options['postId'] ) );
+ $output = $this->renderPostHistoryAPI(
$options, UUID::create( $options['postId'] ) );
} else {
// post history for full topic
- $output = $this->renderTopicHistoryAPI(
$templating, $options );
+ $output = $this->renderTopicHistoryAPI(
$options );
}
} elseif ( $this->action === 'single-view' ) {
if ( isset( $options['revId'] ) ) {
@@ -471,7 +471,7 @@
$output = $this->renderSingleViewAPI( $revId );
} elseif ( $this->action === 'lock-topic' ) {
// Treat topic as a post, only the post + summary are
needed
- $result = $this->renderPostAPI( $templating, $options,
$this->workflow->getId() );
+ $result = $this->renderPostAPI( $options,
$this->workflow->getId() );
$topicId = $result['roots'][0];
$revisionId = $result['posts'][$topicId][0];
$output = $result['revisions'][$revisionId];
@@ -479,11 +479,11 @@
$output = $this->renderDiffViewAPI( $options );
} elseif ( $this->shouldRenderTopicAPI( $options ) ) {
// view full topic
- $output = $this->renderTopicAPI( $templating, $options
);
+ $output = $this->renderTopicAPI( $options );
} else {
// view single post, possibly specific revision
// @todo this isn't valid for the topic title
- $output = $this->renderPostAPI( $templating, $options );
+ $output = $this->renderPostAPI( $options );
}
if ( $output === null ) {
@@ -552,7 +552,7 @@
return $output;
}
- protected function renderTopicAPI( Templating $templating, array
$options, $workflowId = '' ) {
+ protected function renderTopicAPI( array $options, $workflowId = '' ) {
$serializer = Container::get( 'formatter.topic' );
if ( !$workflowId ) {
if ( $this->workflow->isNew() ) {
@@ -587,7 +587,7 @@
* To generate forms with validation errors in the non-javascript
renders we
* need to add something to this output, but not sure what yet
*/
- protected function renderPostAPI( Templating $templating, array
$options, $postId = '' ) {
+ protected function renderPostAPI( array $options, $postId = '' ) {
if ( $this->workflow->isNew() ) {
throw new FlowException( 'No posts can exist for
non-existent topic' );
}
@@ -633,7 +633,7 @@
return $serializer;
}
- protected function renderTopicHistoryAPI( Templating $templating, array
$options ) {
+ protected function renderTopicHistoryAPI( array $options ) {
if ( $this->workflow->isNew() ) {
throw new FlowException( 'No topic history can exist
for non-existant topic' );
}
@@ -641,7 +641,7 @@
return $this->processHistoryResult( $found, $options );
}
- protected function renderPostHistoryAPI( Templating $templating, array
$options, UUID $postId ) {
+ protected function renderPostHistoryAPI( array $options, UUID $postId )
{
if ( $this->workflow->isNew() ) {
throw new FlowException( 'No post history can exist for
non-existant topic' );
}
diff --git a/includes/Block/TopicList.php b/includes/Block/TopicList.php
index 2780808..d707094 100644
--- a/includes/Block/TopicList.php
+++ b/includes/Block/TopicList.php
@@ -164,7 +164,7 @@
return $output;
}
- public function renderAPI( Templating $templating, array $options ) {
+ public function renderAPI( array $options ) {
$serializer = Container::get( 'formatter.topiclist' );
$response = array(
'submitted' => $this->wasSubmitted() ? $this->submitted
: $options,
diff --git a/includes/Block/TopicSummary.php b/includes/Block/TopicSummary.php
index f86e696..724bde2 100644
--- a/includes/Block/TopicSummary.php
+++ b/includes/Block/TopicSummary.php
@@ -254,12 +254,11 @@
/**
* Render the data for API request
*
- * @param Templating $templating
* @param array $options
* @return array
* @throws InvalidInputException
*/
- public function renderAPI( Templating $templating, array $options ) {
+ public function renderAPI( array $options ) {
$output = array( 'type' => $this->getName() );
if ( $this->wasSubmitted() ) {
diff --git a/includes/View.php b/includes/View.php
index 784046f..5e748e5 100644
--- a/includes/View.php
+++ b/includes/View.php
@@ -126,7 +126,7 @@
$editToken = $user->getEditToken();
foreach ( $blocks as $block ) {
if ( $wasPosted ? $block->canSubmit( $action ) :
$block->canRender( $action ) ) {
- $apiResponse['blocks'][] = $block->renderAPI(
$this->templating, $parameters[$block->getName()] )
+ $apiResponse['blocks'][] = $block->renderAPI(
$parameters[$block->getName()] )
+ array(
'title'
=> $apiResponse['title'],
'block-action-template' => $block->getTemplate( $action ),
diff --git a/includes/api/ApiFlowBaseGet.php b/includes/api/ApiFlowBaseGet.php
index 7c1d257..25023fa 100644
--- a/includes/api/ApiFlowBaseGet.php
+++ b/includes/api/ApiFlowBaseGet.php
@@ -10,7 +10,6 @@
$action = $this->getAction();
$user = $this->getUser();
$container = $this->getContainer();
- $templating = $container['templating'];
$passedParams = $loader->extractBlockParameters( $action,
$this->getModifiedRequest(), $blocks );
$output[$action] = array(
@@ -28,7 +27,7 @@
$blockParams =
$passedParams[$block->getName()];
}
- $output[$action]['result'][$block->getName()] =
$block->renderAPI( $templating, $blockParams );
+ $output[$action]['result'][$block->getName()] =
$block->renderAPI( $blockParams );
}
}
diff --git a/includes/api/ApiFlowBasePost.php b/includes/api/ApiFlowBasePost.php
index 5fe8a5e..00f5e0e 100644
--- a/includes/api/ApiFlowBasePost.php
+++ b/includes/api/ApiFlowBasePost.php
@@ -57,7 +57,7 @@
// @Todo - hacky, maybe have contentformat in the
request to overwrite
// requiredWikitext
$block->unsetRequiresWikitext( $action );
- $output[$action]['result'][$block->getName()] =
$block->renderAPI( Container::get( 'templating' ),
$parameters[$block->getName()] );
+ $output[$action]['result'][$block->getName()] =
$block->renderAPI( $parameters[$block->getName()] );
}
// required until php5.4 which has the JsonSerializable
interface
diff --git a/includes/api/ApiQueryFlow.php b/includes/api/ApiQueryFlow.php
index bca52fc..fb07b5a 100644
--- a/includes/api/ApiQueryFlow.php
+++ b/includes/api/ApiQueryFlow.php
@@ -38,10 +38,8 @@
$blockParams = $passedParams[$block->getName()];
}
- $templating = $this->container['templating'];
-
if ( $block->canRender( $params['action'] ) ) {
- $result['blocks'][] = $block->renderAPI(
$templating, $blockParams );
+ $result['blocks'][] = $block->renderAPI(
$blockParams );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/158825
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia0a1071fc8ac9e3fa651a4645bd8a58101b1de83
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits