Page MenuHomePhabricator

De-duplicate the action reason dropdown building code, which is copied around multiple times
Open, LowPublic

Description

Screenshot 2022-02-13 at 21-38-46 Delete Category Foo - Trunk Test.png (1,261×687 px, 70 KB)

The code that builds this dropdown has been copied from DeleteAction to the RevisionCommentSupplement extension (incorrectly), Translate, and now, Nuke (see https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Nuke/+/758037). Complicating matters, it's also used in FileDeleteAction but with different messages using inheritance and constant overrides.

Codesearch: https://codesearch.wmcloud.org/search/?q=deletereason-dropdown&i=nope&files=.php%24&excludeFiles=&repos=

This code should be refactored so extensions can reuse this without having to reimplement/copy it all.

Event Timeline

Legoktm triaged this task as Low priority.

Special:Block is using a similiar reason dropdown via the HTMLSelectAndOtherField as part of a HTMLForm.

This also exists on the following pages, with different select and text htmlform inputs or directly with OOUI text and select widgets.

These usages have a extra label between the dropdown and the text input. selectandother does not.
Some of them using two messages to provide the options, depending on user rrights. selectandother supports one message, but would accept options parsed outside of the form (combined and parsed with Xml::listDropDownOptions)

Jdforrester-WMF renamed this task from Delete reason dropdown building code copied around multiple times to De-duplicate the action reason dropdown building code, which is copied around multiple times.Mar 6 2024, 10:25 PM
Jdforrester-WMF subscribed.

Change 1009610 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] resources: Create mw.widgets.visibleCodePointLimitWithDropDown

https://gerrit.wikimedia.org/r/1009610

Change 1009610 merged by jenkins-bot:

[mediawiki/core@master] resources: Create mw.widgets.visibleCodePointLimitWithDropdown

https://gerrit.wikimedia.org/r/1009610