KartikMistry has uploaded a new change for review.
https://gerrit.wikimedia.org/r/206751
Change subject: Only use templateData when not null
......................................................................
Only use templateData when not null
Bug: T97220
Change-Id: I670fb0cea7e8fc3f98d72a925eb31db8625eb644
---
M modules/tools/ext.cx.tools.template.js
1 file changed, 9 insertions(+), 3 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation
refs/changes/51/206751/1
diff --git a/modules/tools/ext.cx.tools.template.js
b/modules/tools/ext.cx.tools.template.js
index 4f86d9c..281e890 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -105,7 +105,10 @@
*/
TemplateTool.prototype.adaptTitle = function ( targetTitle ) {
// Update the name of the template
- this.templateData.parts[ 0 ].template.target.wt = targetTitle;
+ if ( !this.templateData ) {
+ this.templateData.parts[ 0 ].template.target.wt =
targetTitle;
+ }
+
this.$template.attr( 'data-mw', JSON.stringify(
this.templateData ) );
};
@@ -136,7 +139,7 @@
this.templateData = this.getTemplateData();
this.templateMapping = this.getTemplateMapping();
- if ( !this.templateData || this.templateData.parts.length > 1 )
{
+ if ( !this.templateData ) {
// Either the template is missing mw data or having
multiple
// parts. At present, we cannot handle them.
// An example: {{Version |o |1.1}}{{efn-ua |Due to an
incident ...<ref name="releases" />}}
@@ -146,7 +149,10 @@
return;
}
- this.templateTitle = this.templateData.parts[ 0
].template.target.wt;
+ if ( !this.templateData ) {
+ this.templateTitle = this.templateData.parts[ 0
].template.target.wt;
+ }
+
this.getTargetTemplate()
.done( function ( targetTitleData ) {
var pageId = Object.keys( targetTitleData.pages
)[ 0 ];
--
To view, visit https://gerrit.wikimedia.org/r/206751
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I670fb0cea7e8fc3f98d72a925eb31db8625eb644
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: KartikMistry <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits