Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/189171

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

WIP: 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(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/71/189171/1

diff --git a/includes/Formatter/RevisionFormatter.php 
b/includes/Formatter/RevisionFormatter.php
index 20ed0f7..0f5fb2b 100644
--- a/includes/Formatter/RevisionFormatter.php
+++ b/includes/Formatter/RevisionFormatter.php
@@ -184,6 +184,11 @@
                $moderatedRevision = $this->templating->getModeratedRevision( 
$row->revision );
                $ts = $row->revision->getRevisionId()->getTimestampObj();
                $res = array(
+                       '_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 ),
@@ -243,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' )
@@ -265,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();
@@ -311,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->exists(),
-                       )
+                       ) + $userLinksBCBools,
                );
 
                if ( $talkPageTitle ) {
@@ -329,7 +353,7 @@
                                'url' => $talkPageTitle->getLinkURL(),
                                'title' => $talkPageTitle->getPrefixedText(),
                                'exists' => $talkPageTitle->exists()
-                       );
+                       ) + $userLinksBCBools;
                }
                // is this right permissions? typically this would
                // be sourced from Linker::userToolLinks, but that
@@ -341,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 99dd6be..614d8eb 100644
--- a/includes/Formatter/RevisionViewFormatter.php
+++ b/includes/Formatter/RevisionViewFormatter.php
@@ -46,6 +46,8 @@
                $res['rev_view_links'] = $this->buildLinks( $row );
                $res['human_timestamp'] = $this->getHumanTimestamp( 
$res['timestamp'] );
                if ( $row->revision instanceof PostRevision ) {
+                       // XXX: Is this reachable?  If so, is isTopicTitle 
exposed in the public API
+                       // or used internally?
                        $res['isTopicTitle'] = $row->revision->isTopicTitle();
                        $res['properties']['topic-of-post'] = 
$this->serializer->processParam(
                                'topic-of-post',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief36f80d55d76211839786f7e60aad20ad10c98b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to