Page MenuHomePhabricator

Add a list or autocompletion for sites on Special:GlobalWatchlistSettings
Open, LowPublic4 Estimated Story Points

Description

Having to manually type the URL of wikis to watch is really cumbersome. There should be a drop-down list to pick from.

See also MassMessage ApiQueryMMSites api module and ext.MassMessage.autocomplete.js javascript

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 moved this task from Unsorted to Next on the User-DannyS712 board.
DannyS712 set the point value for this task to 4.

Note that this would also need to take into account T268210: User-defined project domains should be validated - only valid sites should be shown

Okay, so some initial notes:
MassMessage uses jQuery autocomplete by loading jquery.ui, which does work with OOUI text inputs, but doesn't look great. If we use that

  • https://api.jqueryui.com/autocomplete/ is a good reference
  • the site inputs that we need to select: var $sites = $('input[name^="wpsites"]')
  • somehow, options are provided to the front end (perhaps use addJsConfigVars with the valid sites)
var $sites = $('input[name^="wpsites"]')
$sites.autocomplete( {
    source: [ 'abcde', 'abcdz', 'abcdy' ]
} );

where the source array is actually whatever the valid options are
needs to be updated each time a new row is created (infuse the create button and add a listener?)

There is a separate autocomplete system for html forms, at mediawiki.htmlform/autocomplete.js. If we use that

  • use the autocompleteselect type, for HTMLAutoCompleteSelectField

but, that is documented as "HTMLComboboxField implements most of the same functionality and should be used instead, if possible."

or, HTMLComboboxField and combobox type can be used, with options to set the valid options for autocomplete
combobox is used for some existing deployed special pages (Special:PagesWithProp, Special:MIMESearch, wikibase Special:ItemByTitle) but testing them out shows that it doesn't appear that the autocomplete is working properly with OOUI (T154027: HTMLComboboxField does not provide autocomplete in ooui format)


For now, it looks like the best option is using autocompleteselect/HTMLAutoCompleteSelectField, which is already used for SecurePoll and appears to work fine.

$validSites = $this->maybeGetValidSites() ?? [];
$validSites = array_combine( $validSites, $validSites );
$siteFields = [
	'site' => [
		'type' => 'autocompleteselect',
		'autocomplete-data': $validSites,
	],
	...

(Moving to later, waiting until my patch for T154027 is merged to allow using HTMLComboboxField which does exactly this and is preferred over HTMLAutoCompleteSelectField)