jenkins-bot has submitted this change and it was merged.

Change subject: Replace API param 'contentFormat' by 'format'
......................................................................


Replace API param 'contentFormat' by 'format'

In all write API's, we have a param called "format"; felt like this
is more consistent...

Change-Id: Ic0bf6394d2c327b2fac6ac7f7a4b24c3942d1986
---
M i18n/en.json
M i18n/qqq.json
M includes/Api/ApiFlowBasePost.php
M includes/Api/ApiFlowViewHeader.php
M includes/Api/ApiFlowViewPost.php
M includes/Api/ApiFlowViewTopicSummary.php
M includes/Block/Header.php
M includes/Block/Topic.php
M includes/Block/TopicSummary.php
M includes/Formatter/RevisionFormatter.php
M maintenance/convertToText.php
M modules/engine/components/board/base/flow-board-api-events.js
M tests/phpunit/api/ApiFlowViewHeaderTest.php
13 files changed, 50 insertions(+), 27 deletions(-)

Approvals:
  EBernhardson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/i18n/en.json b/i18n/en.json
index 1584875..f2e092d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -472,17 +472,17 @@
        "apihelp-flow+reply-example-1": "Reply to a post on 
[[Topic:S2tycnas4hcucw8w]]",
        "apihelp-flow+reply-param-metadataonly": "Whether to include only 
metadata about the new content, excluding everything else",
        "apihelp-flow+view-header-description": "View a board header.",
-       "apihelp-flow+view-header-param-contentFormat": "Format to return the 
content in.",
+       "apihelp-flow+view-header-param-format": "Format to return the content 
in.",
        "apihelp-flow+view-header-param-revId": "Load this revision, instead of 
the most recent.",
        "apihelp-flow+view-header-example-1": "Fetch the header of 
[[Talk:Sandbox]] as wikitext",
        "apihelp-flow+view-post-description": "View a post.",
        "apihelp-flow+view-post-param-postId": "ID of the post to view.",
-       "apihelp-flow+view-post-param-contentFormat": "Format to return the 
content in.",
+       "apihelp-flow+view-post-param-format": "Format to return the content 
in.",
        "apihelp-flow+view-post-example-1": "Fetch the content of a post on 
[[Topic:S2tycnas4hcucw8w]] as wikitext",
        "apihelp-flow+view-topic-description": "View a topic.",
        "apihelp-flow+view-topic-example-1": "View [[Topic:S2tycnas4hcucw8w]]",
        "apihelp-flow+view-topic-summary-description": "View a topic summary.",
-       "apihelp-flow+view-topic-summary-param-contentFormat": "Format to 
return the content in.",
+       "apihelp-flow+view-topic-summary-param-format": "Format to return the 
content in.",
        "apihelp-flow+view-topic-summary-param-revId": "Load this revision, 
instead of the most recent.",
        "apihelp-flow+view-topic-summary-example-1": "View the summary for 
[[Topic:S2tycnas4hcucw8w]] as wikitext",
        "apihelp-flow+view-topiclist-description": "View a list of topics.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 65615ca..7903c62 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -475,17 +475,17 @@
        "apihelp-flow+reply-example-1": "{{doc-apihelp-example|flow+reply}}",
        "apihelp-flow+reply-param-metadataonly": 
"{{doc-apihelp-param|flow+reply|metadataonly}}",
        "apihelp-flow+view-header-description": 
"{{doc-apihelp-description|flow+view-header}}",
-       "apihelp-flow+view-header-param-contentFormat": 
"{{doc-apihelp-param|flow+view-header|contentFormat}}",
+       "apihelp-flow+view-header-param-format": 
"{{doc-apihelp-param|flow+view-header|format}}",
        "apihelp-flow+view-header-param-revId": 
"{{doc-apihelp-param|flow+view-header|revId}}",
        "apihelp-flow+view-header-example-1": 
"{{doc-apihelp-example|flow+view-header}}",
        "apihelp-flow+view-post-description": 
"{{doc-apihelp-description|flow+view-post}}",
        "apihelp-flow+view-post-param-postId": 
"{{doc-apihelp-param|flow+view-post|postId}}",
-       "apihelp-flow+view-post-param-contentFormat": 
"{{doc-apihelp-param|flow+view-post|contentFormat}}",
+       "apihelp-flow+view-post-param-format": 
"{{doc-apihelp-param|flow+view-post|format}}",
        "apihelp-flow+view-post-example-1": 
"{{doc-apihelp-example|flow+view-post}}",
        "apihelp-flow+view-topic-description": 
"{{doc-apihelp-description|flow+view-topic}}",
        "apihelp-flow+view-topic-example-1": 
"{{doc-apihelp-example|flow+view-topic}}",
        "apihelp-flow+view-topic-summary-description": 
"{{doc-apihelp-description|flow+view-topic-summary}}",
-       "apihelp-flow+view-topic-summary-param-contentFormat": 
"{{doc-apihelp-param|flow+view-topic-summary|contentFormat}}",
+       "apihelp-flow+view-topic-summary-param-format": 
"{{doc-apihelp-param|flow+view-topic-summary|format}}",
        "apihelp-flow+view-topic-summary-param-revId": 
"{{doc-apihelp-param|flow+view-topic-summary|revId}}",
        "apihelp-flow+view-topic-summary-example-1": 
"{{doc-apihelp-example|flow+view-topic-summary}}",
        "apihelp-flow+view-topiclist-description": 
"{{doc-apihelp-description|flow+view-topiclist}}",
diff --git a/includes/Api/ApiFlowBasePost.php b/includes/Api/ApiFlowBasePost.php
index d448987..6b4adb1 100644
--- a/includes/Api/ApiFlowBasePost.php
+++ b/includes/Api/ApiFlowBasePost.php
@@ -59,7 +59,7 @@
                        $output[$action]['result'] = array();
                        foreach( $blocksToCommit as $block ) {
                                // Always return parsed text to client after 
successful submission?
-                               // @Todo - hacky, maybe have contentformat in 
the request to overwrite
+                               // @Todo - hacky, maybe have format in the 
request to overwrite
                                // requiredWikitext
                                $block->unsetRequiresWikitext( $action );
                                $output[$action]['result'][$block->getName()] = 
$block->renderApi( $params[$block->getName()] );
diff --git a/includes/Api/ApiFlowViewHeader.php 
b/includes/Api/ApiFlowViewHeader.php
index e51dca2..01aa15d 100644
--- a/includes/Api/ApiFlowViewHeader.php
+++ b/includes/Api/ApiFlowViewHeader.php
@@ -25,11 +25,15 @@
                global $wgFlowContentFormat;
 
                return array(
-                       'contentFormat' => array(
+                       'format' => array(
                                ApiBase::PARAM_TYPE => array( 'html', 
'wikitext' ),
                                ApiBase::PARAM_DFLT => $wgFlowContentFormat,
                        ),
                        'revId' => null,
+                       'contentFormat' => array(
+                               ApiBase::PARAM_TYPE => array( 'html', 
'wikitext' ),
+                               ApiBase::PARAM_DEPRECATED => true
+                       ),
                );
        }
 
@@ -38,7 +42,7 @@
         */
        public function getParamDescription() {
                return array(
-                       'contentFormat' => 'Format to return the content in',
+                       'format' => 'Format to return the content in',
                        'revId' => 'load a specific revision if provided, 
otherwise, load the most recent',
                );
        }
@@ -55,7 +59,7 @@
         */
        public function getExamples() {
                return array(
-                       
'api.php?action=flow&submodule=view-header&page=Talk:Sandbox&vhcontentFormat=wikitext&revId=',
+                       
'api.php?action=flow&submodule=view-header&page=Talk:Sandbox&vhformat=wikitext&revId=',
                );
        }
 
@@ -64,7 +68,7 @@
         */
        protected function getExamplesMessages() {
                return array(
-                       
'action=flow&submodule=view-header&page=Talk:Sandbox&vhcontentFormat=wikitext&revId='
+                       
'action=flow&submodule=view-header&page=Talk:Sandbox&vhformat=wikitext&revId='
                                => 'apihelp-flow+view-header-example-1',
                );
        }
diff --git a/includes/Api/ApiFlowViewPost.php b/includes/Api/ApiFlowViewPost.php
index 10a8a13..7b68b56 100644
--- a/includes/Api/ApiFlowViewPost.php
+++ b/includes/Api/ApiFlowViewPost.php
@@ -29,9 +29,13 @@
                        'postId' => array(
                                ApiBase::PARAM_REQUIRED => true,
                        ),
-                       'contentFormat' => array(
+                       'format' => array(
                                ApiBase::PARAM_TYPE => array( 'html', 
'wikitext' ),
                                ApiBase::PARAM_DFLT => $wgFlowContentFormat,
+                       ),
+                       'contentFormat' => array(
+                               ApiBase::PARAM_TYPE => array( 'html', 
'wikitext' ),
+                               ApiBase::PARAM_DEPRECATED => true
                        ),
                );
        }
@@ -42,7 +46,7 @@
        public function getParamDescription() {
                return array(
                        'postId' => 'Id of the post to view',
-                       'contentFormat' => 'Format to return the content in',
+                       'format' => 'Format to return the content in',
                );
        }
 
@@ -58,7 +62,7 @@
         */
        public function getExamples() {
                return array(
-                       
'api.php?action=flow&submodule=view-post&page=Topic:S2tycnas4hcucw8w&vppostId=???&vpcontentFormat=wikitext',
+                       
'api.php?action=flow&submodule=view-post&page=Topic:S2tycnas4hcucw8w&vppostId=???&vpformat=wikitext',
                );
        }
 
@@ -67,7 +71,7 @@
         */
        protected function getExamplesMessages() {
                return array(
-                       
'action=flow&submodule=view-post&page=Topic:S2tycnas4hcucw8w&vppostId=???&vpcontentFormat=wikitext'
+                       
'action=flow&submodule=view-post&page=Topic:S2tycnas4hcucw8w&vppostId=???&vpformat=wikitext'
                                => 'apihelp-flow+view-post-example-1',
                );
        }
diff --git a/includes/Api/ApiFlowViewTopicSummary.php 
b/includes/Api/ApiFlowViewTopicSummary.php
index 02b2de6..fc93ae7 100644
--- a/includes/Api/ApiFlowViewTopicSummary.php
+++ b/includes/Api/ApiFlowViewTopicSummary.php
@@ -25,11 +25,15 @@
                global $wgFlowContentFormat;
 
                return array(
-                       'contentFormat' => array(
+                       'format' => array(
                                ApiBase::PARAM_TYPE => array( 'html', 
'wikitext' ),
                                ApiBase::PARAM_DFLT => $wgFlowContentFormat,
                        ),
                        'revId' => null,
+                       'contentFormat' => array(
+                               ApiBase::PARAM_TYPE => array( 'html', 
'wikitext' ),
+                               ApiBase::PARAM_DEPRECATED => true
+                       ),
                );
        }
 
@@ -38,7 +42,7 @@
         */
        public function getParamDescription() {
                return array(
-                       'contentFormat' => 'Format to return the content in',
+                       'format' => 'Format to return the content in',
                        'revId' => 'load a specific revision if provided, 
otherwise, load the most recent',
                );
        }
@@ -55,7 +59,7 @@
         */
        public function getExamples() {
                return array(
-                       
'api.php?action=flow&submodule=view-topic-summary&page=Topic:S2tycnas4hcucw8w&vtscontentFormat=wikitext&revId=',
+                       
'api.php?action=flow&submodule=view-topic-summary&page=Topic:S2tycnas4hcucw8w&vtsformat=wikitext&revId=',
                );
        }
 
@@ -64,7 +68,7 @@
         */
        protected function getExamplesMessages() {
                return array(
-                       
'action=flow&submodule=view-topic-summary&page=Topic:S2tycnas4hcucw8w&vtscontentFormat=wikitext&revId='
+                       
'action=flow&submodule=view-topic-summary&page=Topic:S2tycnas4hcucw8w&vtsformat=wikitext&revId='
                                => 'apihelp-flow+view-topic-summary-example-1',
                );
        }
diff --git a/includes/Block/Header.php b/includes/Block/Header.php
index 05292e3..b9ac998 100644
--- a/includes/Block/Header.php
+++ b/includes/Block/Header.php
@@ -213,6 +213,9 @@
                                        $output += $this->renderSingleViewApi( 
$options['revId'] );
                                } else {
                                        if ( isset( $options['contentFormat'] ) 
&& $options['contentFormat'] === 'wikitext' ) {
+                                               // @deprecated - to be removed 
once ApiFlowViewHeader.php no longer accepts 'contentFormat' param
+                                               $this->requiresWikitext[] = 
'view-header';
+                                       } elseif ( isset( $options['format'] ) 
&& $options['format'] === 'wikitext' ) {
                                                $this->requiresWikitext[] = 
'view-header';
                                        }
                                        $output += $this->renderRevisionApi();
diff --git a/includes/Block/Topic.php b/includes/Block/Topic.php
index 5f60708..5ef2ce9 100644
--- a/includes/Block/Topic.php
+++ b/includes/Block/Topic.php
@@ -641,7 +641,10 @@
                $row = Container::get( 'query.singlepost' )->getResult( 
UUID::create( $postId ) );
                $serializer = $this->getRevisionFormatter();
                if ( isset( $options['contentFormat'] ) ) {
+                       // @deprecated - to be removed once ApiFlowViewPost.php 
no longer accepts 'contentFormat' param
                        $serializer->setContentFormat( 
$options['contentFormat'] );
+               } else if ( isset( $options['format'] ) ) {
+                       $serializer->setContentFormat( $options['format'] );
                }
                $serialized = $serializer->formatApi( $row, $this->context );
                if ( !$serialized ) {
@@ -715,7 +718,10 @@
 
                $serializer = $this->getRevisionFormatter();
                if ( isset( $options['contentFormat'] ) ) {
+                       // @deprecated - to be removed once ApiFlowViewPost.php 
no longer accepts 'contentFormat' param
                        $serializer->setContentFormat( 
$options['contentFormat'] );
+               } elseif ( isset( $options['format'] ) ) {
+                       $serializer->setContentFormat( $options['format'] );
                }
                $serializer->setIncludeHistoryProperties( true );
 
diff --git a/includes/Block/TopicSummary.php b/includes/Block/TopicSummary.php
index 1f47a0a..949588d 100644
--- a/includes/Block/TopicSummary.php
+++ b/includes/Block/TopicSummary.php
@@ -264,6 +264,9 @@
                                        $output['revision'] = 
$formatter->formatApi( $row, $this->context );
                                } else {
                                        if ( isset( $options['contentFormat'] ) 
&& $options['contentFormat'] === 'wikitext' ) {
+                                               // @deprecated - to be removed 
once ApiFlowViewTopicSummary.php no longer accepts 'contentFormat' param
+                                               $this->requiresWikitext[] = 
'view-topic-summary';
+                                       } elseif ( isset( $options['format'] ) 
&& $options['format'] === 'wikitext' ) {
                                                $this->requiresWikitext[] = 
'view-topic-summary';
                                        }
                                        $output += 
$this->renderNewestTopicSummary();
diff --git a/includes/Formatter/RevisionFormatter.php 
b/includes/Formatter/RevisionFormatter.php
index 7ab94fd..5d33d1c 100644
--- a/includes/Formatter/RevisionFormatter.php
+++ b/includes/Formatter/RevisionFormatter.php
@@ -974,5 +974,4 @@
 
                return $this->contentFormat;
        }
-
 }
diff --git a/maintenance/convertToText.php b/maintenance/convertToText.php
index d4f1c7a..3a0c467 100644
--- a/maintenance/convertToText.php
+++ b/maintenance/convertToText.php
@@ -32,7 +32,7 @@
                $topics = array();
                $headerContent = '';
 
-               $headerData = $this->flowApi( $this->pageTitle, 'view-header', 
array( 'vhcontentFormat' => 'wikitext' ), 'header' );
+               $headerData = $this->flowApi( $this->pageTitle, 'view-header', 
array( 'vhformat' => 'wikitext' ), 'header' );
 
                $headerRevision = $headerData['header']['revision'];
                if ( isset( $headerRevision['content'] ) ) {
diff --git a/modules/engine/components/board/base/flow-board-api-events.js 
b/modules/engine/components/board/base/flow-board-api-events.js
index c4413fa..28167d9 100644
--- a/modules/engine/components/board/base/flow-board-api-events.js
+++ b/modules/engine/components/board/base/flow-board-api-events.js
@@ -100,7 +100,7 @@
        
FlowBoardComponentApiEventsMixin.UI.events.apiPreHandlers.activateEditHeader = 
function () {
                return {
                        submodule: 'view-header', // href submodule is 
edit-header
-                       vhcontentFormat: mw.flow.editor.getFormat() // href 
does not have this param
+                       vhformat: mw.flow.editor.getFormat() // href does not 
have this param
                };
        };
 
@@ -116,7 +116,7 @@
                return {
                        submodule: "view-post",
                        vppostId: $( this ).closest( '.flow-topic' ).data( 
'flow-id' ),
-                       vpcontentFormat: mw.flow.editor.getFormat()
+                       vpformat: mw.flow.editor.getFormat()
                };
        };
 
@@ -129,7 +129,7 @@
                return {
                        submodule: 'view-post',
                        vppostId: $( this ).closest( '.flow-post' ).data( 
'flow-id' ),
-                       vpcontentFormat: mw.flow.editor.getFormat()
+                       vpformat: mw.flow.editor.getFormat()
                };
        };
 
@@ -173,7 +173,7 @@
                        // href submodule is edit-topic-summary
                        submodule: 'view-topic-summary',
                        // href does not have this param
-                       vtscontentFormat: mw.flow.editor.getFormat()
+                       vtsformat: mw.flow.editor.getFormat()
                };
        };
 
@@ -188,7 +188,7 @@
                        // href submodule is lock-topic
                        submodule: 'view-post',
                        // href does not have this param
-                       vpcontentFormat: 'wikitext',
+                       vpformat: 'wikitext',
                        // request just the data for this topic
                        vppostId: $( this ).data( 'flow-id' )
                };
diff --git a/tests/phpunit/api/ApiFlowViewHeaderTest.php 
b/tests/phpunit/api/ApiFlowViewHeaderTest.php
index 4f8c59a..402bd0d 100644
--- a/tests/phpunit/api/ApiFlowViewHeaderTest.php
+++ b/tests/phpunit/api/ApiFlowViewHeaderTest.php
@@ -49,7 +49,7 @@
                        'page' => "Talk:Flow_QA",
                        'action' => 'flow',
                        'submodule' => 'view-header',
-                       'vhcontentFormat' => 'html',
+                       'vhformat' => 'html',
                ) );
                $result = $data[0]['flow']['view-header']['result']['header'];
                $debug = json_encode( $result );

-- 
To view, visit https://gerrit.wikimedia.org/r/202337
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic0bf6394d2c327b2fac6ac7f7a4b24c3942d1986
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>
Gerrit-Reviewer: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to