Catrope has uploaded a new change for review.

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

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
---
M ApiVisualEditorEdit.php
1 file changed, 10 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/11/202911/1

diff --git a/ApiVisualEditorEdit.php b/ApiVisualEditorEdit.php
index 660e981..55ef368 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 = $title->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/202911
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2149c7a710075eff9292d0c25ca40d10b325ad44
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

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

Reply via email to