VisualEditor: Transclusion dialog doesn't account for aliases when preventing duplicate entries from being added
Closed, ResolvedPublic

Description

Note that this is not the same as bug 50715. Though they behave the same from the user point of view, bug 50715 is for a case where aliases are not in play.

e.g. given our Unsigned template with parameter "user", "timestamp" and aliases "1" and "2" respectively.

Having added "mw.log('addParameterSearch-select', name, names);" to ve.ui.MWTransclusionDialog#getTemplatePage in the select event handler of the addParameterSearch object; editing the following invocations:

case {{Unsigned|Foo|April 1}}
case {{Unsigned|1=Foo|2=April 1}}

typing "1"
>  addParameterSearch-select null ["1", "2"]
>  addParameterSearch-select "user" ["1", "2"]
> "Add" is enabled
typing "user"
>  addParameterSearch-select null ["1", "2"]
>  addParameterSearch-select "user" ["1", "2"]
> "Add" is enabled

case {{Unsigned|user=Foo|timestamp=April 1}}

typing "1"
>  addParameterSearch-select null ["date", "user"]
>  addParameterSearch-select 1 ["date", "user"]
> "Add" is enabled
typing "user"
>  addParameterSearch-select null ["date", "user"]
>  addParameterSearch-select null ["date", "user"] 
> "Add" is disabled

The latter case actually works as expected, although it is odd that the value given to the select callback is null and not "user" and that the button is already disabled (probably by the select widget?).

Also weird that the callback is constantly triggered twice, once for null and once for the actual value.

Anyway, the solution is to resolve the names to their alias origins before doing the names.indexOf( name ) check.


Version: unspecified
Severity: normal

bzimport set Reference to bz50717.
Krinkle created this task.Via LegacyJul 4 2013, 4:54 AM
Krinkle added a comment.Via ConduitJul 4 2013, 4:55 AM

Working on this.

gerritbot added a comment.Via ConduitJul 10 2013, 7:06 PM

Change 73010 had a related patch set uploaded by Trevor Parscal:
Retain original param names and ignore leading/trailing whitespace

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

gerritbot added a comment.Via ConduitJul 10 2013, 10:57 PM

Change 73010 merged by jenkins-bot:
Retain original param names and ignore leading/trailing whitespace

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

Jdforrester-WMF added a comment.Via ConduitJul 10 2013, 11:03 PM

This is now fixed in master and we will push to production very soon. Sorry for the inconvenience.

Add Comment