Santhosh has uploaded a new change for review.

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

Change subject: Fix: References are adapted with same content
......................................................................

Fix: References are adapted with same content

This was a regression from If9ab5a98ae49b379c01f57a38f0b08c4e3fad122
which started processing internal templates inside templates. Wrong
usuage of array.push caused the Bug T110007

Testplan:

Translate article Factorio from en to fr and publish - All references
must be adapted properly. Content should not be repeated for references.
And for If9ab5a98ae49b379c01f57a38f0b08c4e3fad122, translate
Amblydoras from en to es. Start adding sections from top
to bottom. You will see references section added. Try publishing it.
Publishing will pass. This is normal case. Now translate the same
again and start clicking sections from bottom to top. That means,
you are adding references list first and then section containing reference
later. Try publishing. You will get parsoid error. With this patch,
adding sections in any order will not result publishing error.

Bug: T110007
Change-Id: I044193de3e2815e084489a48817340138fd639e7
---
M modules/tools/ext.cx.tools.template.js
1 file changed, 8 insertions(+), 7 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/13/235413/1

diff --git a/modules/tools/ext.cx.tools.template.js 
b/modules/tools/ext.cx.tools.template.js
index 5833b21..4cda0b4 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -209,18 +209,19 @@
         * @param {jQuery} $section Content translation section
         */
        function processTemplates( $section ) {
-               var templates = [];
+               var i, template, templates = [];
 
                if ( $section.is( '[typeof*="mw:Transclusion"]' ) ) {
                        templates.push( $section );
                }
-               templates.push( $section.find( '[typeof*="mw:Transclusion"]' ) 
);
-
-               $.each( templates, function () {
-                       var template = new TemplateTool( this );
-
+               templates = templates.concat(
+                       // Convert the internal templates to a js array
+                       $.makeArray( $section.find( 
'[typeof*="mw:Transclusion"]' ) )
+               );
+               for ( i = 0; i < templates.length; i++ ) {
+                       template = new TemplateTool( templates[ i ] );
                        template.process();
-               } );
+               }
        }
 
        if ( typeof QUnit !== undefined ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I044193de3e2815e084489a48817340138fd639e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

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

Reply via email to