Santhosh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/275751
Change subject: Do not count a section restored as orphan as orphan again
......................................................................
Do not count a section restored as orphan as orphan again
If a section was not able to restore and if there is a successfully
restored last section exists, we add it after the last restored section.
But once that is done, we should not still add that section to orphans
array. There was a logic error in the code. This commit fixes it.
Change-Id: If62429a1494d746e37c9fadf86c93ac01a21fba9
---
M modules/translation/ext.cx.translation.loader.js
1 file changed, 5 insertions(+), 1 deletion(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation
refs/changes/51/275751/1
diff --git a/modules/translation/ext.cx.translation.loader.js
b/modules/translation/ext.cx.translation.loader.js
index c342fed..31a92bb 100644
--- a/modules/translation/ext.cx.translation.loader.js
+++ b/modules/translation/ext.cx.translation.loader.js
@@ -204,8 +204,11 @@
$lastRestoredSection =
this.addOprhanTranslationUnit(
sourceSectionId,
$lastRestoredSection, 'after'
);
+ } else {
+ // No lastRestoredSection, So add and
keep it in orphans array
+ // to try later.
+ orphans.push( sourceSectionId );
}
- orphans.push( sourceSectionId );
} else {
$lastRestoredSection = $restoredSection;
// As a last resort, if we did not add orphans
immediately, add them
@@ -213,6 +216,7 @@
for ( i = 0; i < orphans.length; i++ ) {
$lastRestoredSection =
this.addOprhanTranslationUnit( orphans[ i ], $lastRestoredSection );
if ( $restoredSection &&
$restoredSection.length ) {
+ // Remove it from the orphans
array.
orphans.splice( i, 1 );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/275751
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If62429a1494d746e37c9fadf86c93ac01a21fba9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits