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

Change subject: When saving, return the full contentSub to the client
......................................................................


When saving, return the full contentSub to the client

And introduce code to make FlaggedRevs add its notices to contentSub.

Bug: 60718
Change-Id: Ibb91dc563ccf73d3b4bd1994134ccf02634fccb5
---
M ApiVisualEditorEdit.php
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve-mw/init/ve.init.mw.Target.js
3 files changed, 32 insertions(+), 14 deletions(-)

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



diff --git a/ApiVisualEditorEdit.php b/ApiVisualEditorEdit.php
index eabc35b..e21e134 100644
--- a/ApiVisualEditorEdit.php
+++ b/ApiVisualEditorEdit.php
@@ -123,8 +123,27 @@
                        if ( $result === false ) {
                                $this->dieUsage( 'Error contacting the Parsoid 
server', 'parsoidserver' );
                        }
+
                        $result['isRedirect'] = $page->isRedirect();
 
+                       if ( class_exists( 'FlaggablePageView' ) ) {
+                               $view = FlaggablePageView::singleton();
+
+                               // Defeat !$this->isPageView( $request ) || 
$request->getVal( 'oldid' ) check in setPageContent
+                               $view->getContext()->setRequest( new 
DerivativeRequest(
+                                       $this->getRequest(),
+                                       array(
+                                               'diff' => null,
+                                               'oldid' => '',
+                                               'action' => 'view'
+                                       ) + $this->getRequest()->getValues()
+                               ) );
+
+                               $view->setPageContent();
+                               $view->displayTag();
+                       }
+                       $result['contentSub'] = 
$this->getOutput()->getSubtitle();
+
                        $content = new WikitextContent( $wikitext );
                        $parserOutput = $content->getParserOutput( $page );
                        if ( $parserOutput ) {
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 0c6726b..3e70f88 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -439,7 +439,7 @@
  * @param {Object} lastModified Object containing user-formatted date and time 
strings
  */
 ve.init.mw.ViewPageTarget.prototype.onSave = function (
-       html, categoriesHtml, newid, isRedirect, displayTitle, lastModified
+       html, categoriesHtml, newid, isRedirect, displayTitle, lastModified, 
contentSub
 ) {
        var newUrlParams, watchChecked;
        this.saveDeferred.resolve();
@@ -482,7 +482,13 @@
                        this.revid = newid;
                }
                this.saveDialog.reset();
-               this.replacePageContent( html, categoriesHtml, isRedirect, 
displayTitle, lastModified );
+               this.replacePageContent(
+                       html,
+                       categoriesHtml,
+                       displayTitle,
+                       lastModified,
+                       contentSub
+               );
                this.setupSectionEditLinks();
                this.tearDownBeforeUnloadHandler();
                this.deactivate( true );
@@ -1519,12 +1525,12 @@
  * @method
  * @param {string} html Rendered HTML from server
  * @param {string} categoriesHtml Rendered categories HTML from server
- * @param {boolean} isRedirect Whether this page is a redirect or not
  * @param {string} displayTitle What HTML to show as the page title
  * @param {Object} lastModified Object containing user-formatted date and time 
strings
+ * @param {string} contentSub What HTML to show as the content subtitle
  */
 ve.init.mw.ViewPageTarget.prototype.replacePageContent = function (
-       html, categoriesHtml, isRedirect, displayTitle, lastModified
+       html, categoriesHtml, displayTitle, lastModified, contentSub
 ) {
        var $content = $( $.parseHTML( html ) ), $editableContent;
 
@@ -1555,15 +1561,7 @@
                $( '#content > #firstHeading > span:first' ).html( displayTitle 
);
        }
        $( '#catlinks' ).replaceWith( categoriesHtml );
-       if ( isRedirect && !$( '#contentSub > #redirectsub' ).length ) {
-               $( '#contentSub' ).append(
-                       $( '<span>' )
-                               .attr( 'id', 'redirectsub' )
-                               .text( ve.msg( 'redirectpagesub' ) )
-               );
-       } else if ( !isRedirect ) {
-               $( '#contentSub > #redirectsub' ).remove();
-       }
+       $( '#contentSub' ).html( contentSub );
 };
 
 /**
diff --git a/modules/ve-mw/init/ve.init.mw.Target.js 
b/modules/ve-mw/init/ve.init.mw.Target.js
index 03ab0ce..322d196 100644
--- a/modules/ve-mw/init/ve.init.mw.Target.js
+++ b/modules/ve-mw/init/ve.init.mw.Target.js
@@ -564,7 +564,8 @@
                        data.newrevid,
                        data.isRedirect,
                        data.displayTitleHtml,
-                       data.lastModified
+                       data.lastModified,
+                       data.contentSub
                );
        }
 };

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibb91dc563ccf73d3b4bd1994134ccf02634fccb5
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to