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

Change subject: Explicitly pass oldid to ApiParse after saving
......................................................................


Explicitly pass oldid to ApiParse after saving

If we don't explicitly pass the revid of the new revision we
just created, ApiParse will be lazy and get the latest revid
from the slave DB, which will probably be out of date.

Bug: T95466
Bug: T94367
Change-Id: I2149c7a710075eff9292d0c25ca40d10b325ad44
(cherry picked from commit 25c718bc9616850d670fd15390dc8f697580becf)
---
M ApiVisualEditorEdit.php
1 file changed, 10 insertions(+), 9 deletions(-)

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



diff --git a/ApiVisualEditorEdit.php b/ApiVisualEditorEdit.php
index 660e981..45dd69d 100644
--- a/ApiVisualEditorEdit.php
+++ b/ApiVisualEditorEdit.php
@@ -60,10 +60,11 @@
                }
        }
 
-       protected function parseWikitext( $title ) {
+       protected function parseWikitext( $title, $newRevId ) {
                $apiParams = array(
                        'action' => 'parse',
                        'page' => $title->getPrefixedDBkey(),
+                       'oldid' => $newRevId,
                        'prop' => 'text|revid|categorieshtml|displaytitle',
                );
                $api = new ApiMain(
@@ -159,18 +160,18 @@
 
                // Success
                } else {
-                       if ( isset( $saveresult['edit']['newrevid'] )
-                               && $this->veConfig->get( 
'VisualEditorUseChangeTagging' )
-                       ) {
-                               ChangeTags::addTags( 'visualeditor', null,
-                                       intval( $saveresult['edit']['newrevid'] 
),
-                                       null
-                               );
+                       if ( isset( $saveresult['edit']['newrevid'] ) ) {
+                               $newRevId = intval( 
$saveresult['edit']['newrevid'] );
+                               if ( $this->veConfig->get( 
'VisualEditorUseChangeTagging' ) ) {
+                                       ChangeTags::addTags( 'visualeditor', 
null, $newRevId, null );
+                               }
+                       } else {
+                               $newRevId = $page->getLatestRevId();
                        }
 
                        // Return result of parseWikitext instead of 
saveWikitext so that the
                        // frontend can update the page rendering without a 
refresh.
-                       $result = $this->parseWikitext( $page );
+                       $result = $this->parseWikitext( $page, $newRevId );
                        if ( $result === false ) {
                                $this->dieUsage( 'Error contacting the Parsoid 
server', 'parsoidserver' );
                        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2149c7a710075eff9292d0c25ca40d10b325ad44
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: wmf/1.26wmf1
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to