Merge "Streamline and harden template paramter search widget behavior"

This commit is contained in:
jenkins-bot 2021-08-20 08:35:45 +00:00 committed by Gerrit Code Review
commit d3e8fe001c

View file

@ -105,16 +105,16 @@ ve.ui.MWParameterPlaceholderPage.prototype.setOutlineItem = function () {
};
ve.ui.MWParameterPlaceholderPage.prototype.onParameterChoose = function ( name ) {
if ( !name ) {
this.addParameterSearch.query.setValue( '' );
if ( !name || this.template.hasParameter( name ) ) {
return;
}
// Note that every parameter is known after it is added
var knownBefore = this.template.getSpec().isKnownParameterOrAlias( name ),
param = new ve.dm.MWParameterModel( this.template, name );
var knownBefore = this.template.getSpec().isKnownParameterOrAlias( name );
this.addParameterSearch.query.setValue( '' );
this.template.addParameter( param );
this.template.addParameter( new ve.dm.MWParameterModel( this.template, name ) );
ve.track( 'activity.transclusion', {
action: knownBefore ? 'add-known-parameter' : 'add-unknown-parameter'