mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Merge "Remove uppercase of first character of auprefix"
This commit is contained in:
commit
c7d82f4ddc
|
@ -7,7 +7,7 @@
|
|||
"descriptionmsg": "discussiontools-desc",
|
||||
"manifest_version": 2,
|
||||
"requires": {
|
||||
"MediaWiki": ">= 1.37.0",
|
||||
"MediaWiki": ">= 1.38.0",
|
||||
"extensions": {
|
||||
"VisualEditor": ">= 0.1.2",
|
||||
"Linter": "*"
|
||||
|
|
|
@ -91,19 +91,17 @@ MWUsernameCompletionAction.prototype.insertAndOpen = function () {
|
|||
};
|
||||
|
||||
MWUsernameCompletionAction.prototype.getSuggestions = function ( input ) {
|
||||
var capitalizedInput = input.length > 0 && input[ 0 ].toUpperCase() + input.slice( 1 ),
|
||||
title = mw.Title.makeTitle( mw.config.get( 'wgNamespaceIds' ).user, input ),
|
||||
var title = mw.Title.makeTitle( mw.config.get( 'wgNamespaceIds' ).user, input ),
|
||||
validatedInput = title ? input : '',
|
||||
action = this;
|
||||
|
||||
this.api.abort(); // Abort all unfinished API requests
|
||||
var apiPromise;
|
||||
if ( capitalizedInput && !this.searchedPrefixes[ capitalizedInput ] ) {
|
||||
if ( input.length > 0 && !this.searchedPrefixes[ input ] ) {
|
||||
apiPromise = this.api.get( {
|
||||
action: 'query',
|
||||
list: 'allusers',
|
||||
// Prefix of list=allusers is case sensitive, and users are stored in the DB capitalized, so:
|
||||
auprefix: capitalizedInput,
|
||||
auprefix: input,
|
||||
aulimit: this.limit
|
||||
} ).then( function ( response ) {
|
||||
var suggestions = response.query.allusers.map( function ( user ) {
|
||||
|
@ -117,7 +115,7 @@ MWUsernameCompletionAction.prototype.getSuggestions = function ( input ) {
|
|||
action.remoteUsers.push.apply( action.remoteUsers, suggestions );
|
||||
action.remoteUsers.sort();
|
||||
|
||||
action.searchedPrefixes[ capitalizedInput ] = true;
|
||||
action.searchedPrefixes[ input ] = true;
|
||||
} );
|
||||
} else {
|
||||
apiPromise = ve.createDeferred().resolve().promise();
|
||||
|
@ -130,7 +128,7 @@ MWUsernameCompletionAction.prototype.getSuggestions = function ( input ) {
|
|||
return action.filterSuggestionsForInput(
|
||||
action.localUsers
|
||||
// Show no remote users if no input provided
|
||||
.concat( capitalizedInput ? action.remoteUsers : [] ),
|
||||
.concat( input.length > 0 ? action.remoteUsers : [] ),
|
||||
// TODO: Consider showing IP users
|
||||
// * Change link to Special:Contributions/<ip> (localised)
|
||||
// * Let users know that mentioning an IP will not create a notification?
|
||||
|
|
Loading…
Reference in a new issue