ApiVisualEditorEdit: Fix handling of 'minor' parameter

The client-side code sends the empty string as the value of this
parameter when the edit should be marked as minor, and doesn't set it
at all when it shouldn't (this is the normal convention for boolean
parameters). However, the API code here was incorrectly handling the
empty string, and not marking the edit as minor as a result.

This was revealed by 50883dd7fe. Prior
to that change the original 'minor' parameter was forwarded to the
action=edit call if it was provided, overriding the 'notminor'
parameter, which was effectively added unconditionally.

Bug: T248257
Change-Id: I37fd73851d94906d79943692fb9136da03ea95fa
This commit is contained in:
Bartosz Dziewoński 2020-03-23 17:36:22 +01:00
parent fa3363972d
commit 73dcfb7122

View file

@ -48,7 +48,7 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
'errorformat' => 'html', 'errorformat' => 'html',
]; ];
if ( $params['minor'] ) { if ( $params['minor'] !== null ) {
$apiParams['minor'] = true; $apiParams['minor'] = true;
} else { } else {
$apiParams['notminor'] = true; $apiParams['notminor'] = true;