mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Don't pass through edit API params we've already handled
This can lead to problems if the names in the VE API are still used inthe Edit API, as previously happened with `watch`/`watchlist`. Explicitly list the parameters from VE API that were previously getting passed to the Edit API automatically. Change-Id: I8fe705b178af82d8285067909168d32cfb9a0421
This commit is contained in:
parent
42194ec411
commit
50883dd7fe
|
@ -40,6 +40,11 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
|
|||
'starttimestamp' => $params['starttimestamp'],
|
||||
'token' => $params['token'],
|
||||
'watchlist' => $params['watchlist'],
|
||||
'tags' => $params['tags'],
|
||||
'section' => $params['section'],
|
||||
'sectiontitle' => $params['sectiontitle'],
|
||||
'captchaid' => $params['captchaid'],
|
||||
'captchaword' => $params['captchaword'],
|
||||
'errorformat' => 'html',
|
||||
];
|
||||
|
||||
|
@ -49,21 +54,21 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
|
|||
$apiParams['notminor'] = true;
|
||||
}
|
||||
|
||||
if ( $params['captchaid'] ) {
|
||||
$apiParams['captchaid'] = $params['captchaid'];
|
||||
}
|
||||
|
||||
if ( $params['captchaword'] ) {
|
||||
$apiParams['captchaword'] = $params['captchaword'];
|
||||
// Pass any unrecognized query parameters to the internal action=edit API request. This is
|
||||
// necessary to support extensions that add extra stuff to the edit form (e.g. FlaggedRevs)
|
||||
// and allows passing any other query parameters to be used for edit tagging (e.g. T209132).
|
||||
// Exclude other known params from here and ApiMain.
|
||||
// TODO: This doesn't exclude params from the formatter
|
||||
$allParams = $this->getRequest()->getValues();
|
||||
$knownParams = array_keys( $this->getAllowedParams() + $this->getMain()->getAllowedParams() );
|
||||
foreach ( $knownParams as $knownParam ) {
|
||||
unset( $allParams[ $knownParam ] );
|
||||
}
|
||||
|
||||
$api = new ApiMain(
|
||||
new DerivativeRequest(
|
||||
$this->getRequest(),
|
||||
// Pass any unrecognized query parameters to the internal action=edit API request. This is
|
||||
// necessary to support extensions that add extra stuff to the edit form (e.g. FlaggedRevs)
|
||||
// and allows passing any other query parameters to be used for edit tagging (e.g. T209132).
|
||||
$apiParams + $this->getRequest()->getValues(),
|
||||
$apiParams + $allParams,
|
||||
/* was posted? */ true
|
||||
),
|
||||
/* enable write? */ true
|
||||
|
|
Loading…
Reference in a new issue