jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/363026 )

Change subject: Normalize to template namespace when comparing
......................................................................


Normalize to template namespace when comparing

Bug: T169307
Change-Id: Ic3524819fb026713b27b193e4a03338fffd97229
---
M modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
1 file changed, 6 insertions(+), 4 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
index 0b6aa7b..cdb1d0d 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
@@ -339,10 +339,12 @@
  * @return {boolean} Transclusion only contains a single template, which is 
one of the ones in templates
  */
 ve.dm.MWTransclusionNode.prototype.isSingleTemplate = function ( templates ) {
-       var i, len, partsList = this.getPartsList();
+       var i, len,
+               templateNS = mw.config.get( 'wgNamespaceIds' ).template,
+               partsList = this.getPartsList();
 
-       function normalizeTitle( name ) {
-               var title = mw.Title.newFromText( name );
+       function normalizeTemplateTitle( name ) {
+               var title = mw.Title.newFromText( name, templateNS );
                return title ? title.getPrefixedText() : name;
        }
 
@@ -358,7 +360,7 @@
        for ( i = 0, len = templates.length; i < len; i++ ) {
                if (
                        partsList[ 0 ].templatePage &&
-                       partsList[ 0 ].templatePage === normalizeTitle( 
templates[ i ] )
+                       partsList[ 0 ].templatePage === normalizeTemplateTitle( 
templates[ i ] )
                ) {
                        return true;
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/363026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic3524819fb026713b27b193e4a03338fffd97229
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to