mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
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
This commit is contained in:
parent
685e7ffacb
commit
25c718bc96
|
@ -60,10 +60,11 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
|
|||
|
||||
// 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' );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue