Page MenuHomePhabricator

ApiOptionsHook should allow modifying options
Open, Needs TriagePublicBUG REPORT

Description

ApiOptionsHook passes the array of changes that a user wants make, but doe not allow modifying.

Some extensions may want manipulate the changes array; for example to ensure existence of dependent options.

For example, WikimediaIncubator requires that if incubatortestwiki-project is set, then incubatortestwiki-code must also be set at the same time. The web UI enforces this and aborts save but the API does not and results in T290195 if the former is set without the latter.

WikimediaIncubator may want to aborts the save in API too, or replace incompatible values with default. Either solution would require improving ApiOptionsHook first.

The hook has two subscribers https://codesearch-beta.wmcloud.org/search/?files=&i=nope&q=onApiOptions

Event Timeline

SD0001 subscribed.

Couldn't SaveUserOptionsHook be used instead, as that's abortable?

I think it can be used partially (i.e to block save or modify the value), but you cannot communicate back error/warning to the API (at least without some core modification).

Reedy renamed this task from ApiOptionsHook should allow modifying options. to ApiOptionsHook should allow modifying options.Feb 28 2022, 11:57 AM
Reedy updated the task description. (Show Details)