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

Change subject: Add backwards-compat metadata so booleans keep working right
......................................................................


Add backwards-compat metadata so booleans keep working right

In preparation for I7b37295e8862b188d1f3b0cd07f66ac34629678f

Without this, there is at least one user-facing issue, T86852,
but probably more, with that core patch checked out.

This is the approach Anomie recommended.

Bug: T86852
Change-Id: Ief36f80d55d76211839786f7e60aad20ad10c98b
---
M includes/Formatter/RevisionFormatter.php
M includes/Formatter/RevisionViewFormatter.php
2 files changed, 30 insertions(+), 5 deletions(-)

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



diff --git a/includes/Formatter/RevisionFormatter.php 
b/includes/Formatter/RevisionFormatter.php
index 8ca5be1..767adda 100644
--- a/includes/Formatter/RevisionFormatter.php
+++ b/includes/Formatter/RevisionFormatter.php
@@ -182,6 +182,13 @@
                $moderatedRevision = $this->templating->getModeratedRevision( 
$row->revision );
                $ts = $row->revision->getRevisionId()->getTimestampObj();
                $res = array(
+                       // Change all '_BC_bools' to ApiResult::META_BC_BOOLS 
when core
+                       // change is merged.
+                       '_BC_bools' => array(
+                               // https://gerrit.wikimedia.org/r/#/c/182858/
+                               'isOriginalContent',
+                               'isModerated',
+                       ),
                        'workflowId' => 
$row->workflow->getId()->getAlphadecimal(),
                        'revisionId' => 
$row->revision->getRevisionId()->getAlphadecimal(),
                        'timestamp' => $ts->getTimestamp( TS_MW ),
@@ -241,6 +248,13 @@
                }
 
                if ( $row instanceof TopicRow ) {
+                       $res['_BC_bools'] = array_merge(
+                               $res['_BC_bools'],
+                               array(
+                                       'isWatched',
+                                       'watchable',
+                               )
+                       );
                        if (
                                $row->summary &&
                                $this->permissions->isAllowed( $row->summary, 
'view' )
@@ -263,6 +277,13 @@
                }
 
                if ( $row->revision instanceof PostRevision ) {
+                       $res['_BC_bools'] = array_merge(
+                               $res['_BC_bools'],
+                               array(
+                                       'isMaxThreadingDepth',
+                               )
+                       );
+
                        $replyTo = $row->revision->getReplyToId();
                        $res['replyToId'] = $replyTo ? 
$replyTo->getAlphadecimal() : null;
                        $res['postId'] = 
$row->revision->getPostId()->getAlphadecimal();
@@ -309,17 +330,22 @@
                $blockTitle = \SpecialPage::getTitleFor( 'Block', $name );
 
                $userContribsTitle = \SpecialPage::getTitleFor( 
'Contributions', $name );
+               $userLinksBCBools = array(
+                       '_BC_bools' => array(
+                               'exists',
+                       ),
+               );
                $links = array(
                        'contribs' => array(
                                'url' => $userContribsTitle->getLinkURL(),
                                'title' => $userContribsTitle->getText(),
                                'exists' => true,
-                       ),
+                       ) + $userLinksBCBools,
                        'userpage' => array(
                                'url' => $userTitle->getLinkURL(),
                                'title' => $userTitle->getText(),
                                'exists' => $userTitle->isKnown(),
-                       )
+                       ) + $userLinksBCBools,
                );
 
                if ( $talkPageTitle ) {
@@ -327,7 +353,7 @@
                                'url' => $talkPageTitle->getLinkURL(),
                                'title' => $talkPageTitle->getPrefixedText(),
                                'exists' => $talkPageTitle->isKnown()
-                       );
+                       ) + $userLinksBCBools;
                }
                // is this right permissions? typically this would
                // be sourced from Linker::userToolLinks, but that
@@ -339,7 +365,7 @@
                                        'url' => $blockTitle->getLinkURL(),
                                        'title' => wfMessage( 'blocklink' ),
                                        'exists' => true
-                               ),
+                               ) + $userLinksBCBools,
                        );
                }
 
diff --git a/includes/Formatter/RevisionViewFormatter.php 
b/includes/Formatter/RevisionViewFormatter.php
index 82875a6..8a722a0 100644
--- a/includes/Formatter/RevisionViewFormatter.php
+++ b/includes/Formatter/RevisionViewFormatter.php
@@ -38,7 +38,6 @@
                $res['rev_view_links'] = $this->buildLinks( $row );
                $res['human_timestamp'] = $this->getHumanTimestamp( 
$res['timestamp'] );
                if ( $row->revision instanceof PostRevision ) {
-                       $res['isTopicTitle'] = $row->revision->isTopicTitle();
                        $res['properties']['topic-of-post'] = 
$this->serializer->processParam(
                                'topic-of-post',
                                $row->revision,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ief36f80d55d76211839786f7e60aad20ad10c98b
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: Matthias Mullie <mmul...@wikimedia.org>
Gerrit-Reviewer: SG <shah...@gmail.com>
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