Merge "Use correct metadata when adding exact query match"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 27 Aug 2019 15:34:43 +0000 (15:34 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 27 Aug 2019 15:34:43 +0000 (15:34 +0000)
resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js

index 22bac08..b129303 100644 (file)
                        )
                );
 
-               if ( this.cache ) {
-                       this.cache.set( pageData );
-               }
-
                // Offer the exact text as a suggestion if the page exists
                if ( this.addQueryInput && pageExists && !pageExistsExact ) {
                        titles.unshift( this.getQueryValue() );
+                       // Ensure correct page metadata gets used
+                       pageData[ this.getQueryValue() ] = pageData[ titleObj.getPrefixedText() ];
+               }
+
+               if ( this.cache ) {
+                       this.cache.set( pageData );
                }
 
                for ( i = 0, len = titles.length; i < len; i++ ) {