Catrope has uploaded a new change for review.
https://gerrit.wikimedia.org/r/59354
Change subject: Actually pass oldid parameter when serializing
......................................................................
Actually pass oldid parameter when serializing
Apparently Parsoid has always required this, and we've never sent it,
yet somehow the code in production works. This may well be the cause
of some of the selser issues we saw after the deployment attempt in
January.
Change-Id: I3a55025246014cd74e15d6d5b6c4ede7b823e5df
---
M ApiVisualEditor.php
M modules/ve/init/mw/ve.init.mw.Target.js
2 files changed, 10 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/54/59354/1
diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index 1084b65..45c89e4 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -67,15 +67,19 @@
);
}
- protected function postHTML( $title, $html ) {
+ protected function postHTML( $title, $html, $parserParams ) {
global $wgVisualEditorParsoidURL, $wgVisualEditorParsoidPrefix,
$wgVisualEditorParsoidTimeout;
+ if ( !isset( $parserParams['oldid'] ) ) {
+ $parserParams['oldid'] = $title->getLatestRevId();
+ }
return Http::post(
$wgVisualEditorParsoidURL . '/' .
$wgVisualEditorParsoidPrefix .
'/' . urlencode( $title->getPrefixedDBkey() ),
array(
'postData' => array( 'content' => $html ),
- 'timeout' => $wgVisualEditorParsoidTimeout
+ 'timeout' => $wgVisualEditorParsoidTimeout,
+ 'oldid' => $parserParams['oldid']
)
);
}
@@ -211,14 +215,14 @@
if ( $params['html'] === null ) {
$this->dieUsageMsg( 'missingparam', 'html' );
}
- $serialized = array( 'content' => $this->postHTML(
$page, $params['html'] ) );
+ $serialized = array( 'content' => $this->postHTML(
$page, $params['html'], $parserParams ) );
if ( $serialized === false ) {
$this->dieUsage( 'Error contacting the Parsoid
server', 'parsoidserver' );
} else {
$result = array_merge( array( 'result' =>
'success' ), $serialized );
}
} elseif ( $params['paction'] === 'save' || $params['paction']
=== 'diff' ) {
- $wikitext = $this->postHTML( $page, $params['html'] );
+ $wikitext = $this->postHTML( $page, $params['html'],
$parserParams );
if ( $wikitext === false ) {
$this->dieUsage( 'Error contacting the Parsoid
server', 'parsoidserver' );
diff --git a/modules/ve/init/mw/ve.init.mw.Target.js
b/modules/ve/init/mw/ve.init.mw.Target.js
index 05abd6f..f8c7d69 100644
--- a/modules/ve/init/mw/ve.init.mw.Target.js
+++ b/modules/ve/init/mw/ve.init.mw.Target.js
@@ -462,6 +462,7 @@
'action': 'visualeditor',
'paction': 'diff',
'page': this.pageName,
+ 'oldid': this.oldid,
'html': doc.body.innerHTML, // TODO make this send the
whole document in the future
// TODO: API required editToken, though not relevant
for diff
'token': this.editToken
@@ -552,6 +553,7 @@
'paction': 'serialize',
'html': doc.body.innerHTML, // TODO make this send the
whole document in the future
'page': this.pageName,
+ 'oldid': this.oldid,
'token': this.editToken,
'format': 'json'
},
--
To view, visit https://gerrit.wikimedia.org/r/59354
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a55025246014cd74e15d6d5b6c4ede7b823e5df
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