ApiVisualEditorEdit: Make tags param actually work

Why:
ApiVisualEditorEdit passes most of its params down to
action=edit. However, $params contains parsed version
of the params. Using it with tags results in the param
validator logic on ApiEdit's end receiving a PHP array,
which it does not expect (neither it should; it is impossible
to pass one via an actual API call).

This feature will be used in DiscussionTools,
which itself reuses ApiVisualEditorEdit.

What:
Use WebRequest::getText() to get the unparsed
value for 'tags', which makes the parameter
forwarding actually work.

Bug: T343339
Change-Id: I0ac60ca8473fe28461b2da60f9911baac4994388
This commit is contained in:
Martin Urbanec 2023-08-02 17:52:11 +02:00
parent c9fceaedaa
commit 35320775e3

View file

@ -92,7 +92,9 @@ class ApiVisualEditorEdit extends ApiBase {
'starttimestamp' => $params['starttimestamp'],
'token' => $params['token'],
'watchlist' => $params['watchlist'],
'tags' => $params['tags'],
// NOTE: Must use getText() to work; PHP array from $params['tags'] is not understood
// by the edit API.
'tags' => $this->getRequest()->getText( 'tags' ),
'section' => $params['section'],
'sectiontitle' => $params['sectiontitle'],
'captchaid' => $params['captchaid'],