Page MenuHomePhabricator

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

Details

Reference
bz50717

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:11 AM
bzimport set Reference to bz50717.

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

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

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

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