Merge "mw.widgets.TitleInputWidget: Don't bypass namespace choice with redirects"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 22 Jul 2015 15:16:55 +0000 (15:16 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 22 Jul 2015 15:16:55 +0000 (15:16 +0000)
resources/src/mediawiki.widgets/mw.widgets.TitleInputWidget.js

index a9e4384..66b009f 100644 (file)
                                imageUrl: OO.getProp( suggestionPage, 'thumbnail', 'source' ),
                                description: OO.getProp( suggestionPage, 'terms', 'description' )
                        };
-                       titles.push( suggestionPage.title );
+
+                       // Throw away pages from wrong namespaces. This can happen when 'showRedirectTargets' is true
+                       // and we encounter a cross-namespace redirect.
+                       if ( this.namespace === null || this.namespace === suggestionPage.ns ) {
+                               titles.push( suggestionPage.title );
+                       }
 
                        redirects = redirectsTo[suggestionPage.title] || [];
                        for ( i = 0, len = redirects.length; i < len; i++ ) {