[MediaWiki-commits] [Gerrit] Revert "Do not attempt adding orphan section unless source a... - change (mediawiki...ContentTranslation)

2016-03-10 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Revert "Do not attempt adding orphan section unless source 
article is old revision"
..


Revert "Do not attempt adding orphan section unless source article is old 
revision"

This reverts commit b222dfdbea064718b0953619739df39fd2121ea4.

Change-Id: I66ec5ef18ab339d4921188bb2391596722ec3798
---
M modules/translation/ext.cx.translation.loader.js
M tests/qunit/translation/ext.cx.translation.loader.test.js
2 files changed, 3 insertions(+), 14 deletions(-)

Approvals:
  KartikMistry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/translation/ext.cx.translation.loader.js 
b/modules/translation/ext.cx.translation.loader.js
index 6a7b493..31a92bb 100644
--- a/modules/translation/ext.cx.translation.loader.js
+++ b/modules/translation/ext.cx.translation.loader.js
@@ -17,7 +17,6 @@
this.$sourceColumn = null;
this.$translationColumn = null;
this.disabled = false;
-   this.oldRevision = false;
}
 
/**
@@ -103,12 +102,7 @@
self.restore();
mw.hook( 'mw.cx.draft.restored' ).fire();
if ( self.translation.sourceRevisionId !== 
mw.cx.sourceRevision ) {
-   // Show a message to translator that we 
loaded an older revision of
-   // source article.
self.showOldRevisionWarning();
-   // Since we are using older revision, 
use agressive section restore
-   // algorithm.
-   self.oldRevision = true;
}
} );
}, function ( errorCode, details ) {
@@ -206,7 +200,7 @@
if ( !$restoredSection ) {
mw.log( 'Source section not found for ' + 
sourceSectionId );
// Insert right after last matched section if 
possible
-   if ( this.oldRevision && $lastRestoredSection 
&& $lastRestoredSection.length ) {
+   if ( $lastRestoredSection && 
$lastRestoredSection.length ) {
$lastRestoredSection = 
this.addOprhanTranslationUnit(
sourceSectionId, 
$lastRestoredSection, 'after'
);
@@ -219,10 +213,6 @@
$lastRestoredSection = $restoredSection;
// As a last resort, if we did not add orphans 
immediately, add them
// now before this section.
-   if ( !this.oldRevision ) {
-   // Dont use orphan sections unless we 
are using old source article
-   continue;
-   }
for ( i = 0; i < orphans.length; i++ ) {
$lastRestoredSection = 
this.addOprhanTranslationUnit( orphans[ i ], $lastRestoredSection );
if ( $restoredSection && 
$restoredSection.length ) {
@@ -233,7 +223,7 @@
}
}
 
-   if ( orphans.length && !this.oldRevision ) {
+   if ( orphans.length ) {
mw.log( 'Draft restoration failed. Loading older 
revision.' );
window.location = mw.cx.siteMapper.getCXUrl(
mw.cx.sourceTitle,
diff --git a/tests/qunit/translation/ext.cx.translation.loader.test.js 
b/tests/qunit/translation/ext.cx.translation.loader.test.js
index 1a3910a..24055b7 100644
--- a/tests/qunit/translation/ext.cx.translation.loader.test.js
+++ b/tests/qunit/translation/ext.cx.translation.loader.test.js
@@ -52,8 +52,7 @@
QUnit.test( 'Translation daft restore test', function ( assert ) {
var i;
QUnit.expect( tests.length );
-   // Without old revision flag set true, orphan sections wont get 
added.
-   this.translatonLoader.oldRevision = true;
+
for ( i = 0; i < tests.length; i++ ) {
this.translatonLoader.translationUnits = 
this.translatonLoader.getTranslationUnits( tests[ i ].draft );
this.translatonLoader.$sourceColumn = $( tests[ i 
].source );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I66ec5ef18ab339d4921188bb2391596722ec3798
Gerrit-PatchSet: 1
Gerrit-Project: 

[MediaWiki-commits] [Gerrit] Revert "Do not attempt adding orphan section unless source a... - change (mediawiki...ContentTranslation)

2016-03-10 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Revert "Do not attempt adding orphan section unless source 
article is old revision"
..


Revert "Do not attempt adding orphan section unless source article is old 
revision"

This reverts commit b222dfdbea064718b0953619739df39fd2121ea4.

Change-Id: I66ec5ef18ab339d4921188bb2391596722ec3798
---
M modules/translation/ext.cx.translation.loader.js
M tests/qunit/translation/ext.cx.translation.loader.test.js
2 files changed, 3 insertions(+), 14 deletions(-)

Approvals:
  KartikMistry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/translation/ext.cx.translation.loader.js 
b/modules/translation/ext.cx.translation.loader.js
index 6a7b493..31a92bb 100644
--- a/modules/translation/ext.cx.translation.loader.js
+++ b/modules/translation/ext.cx.translation.loader.js
@@ -17,7 +17,6 @@
this.$sourceColumn = null;
this.$translationColumn = null;
this.disabled = false;
-   this.oldRevision = false;
}
 
/**
@@ -103,12 +102,7 @@
self.restore();
mw.hook( 'mw.cx.draft.restored' ).fire();
if ( self.translation.sourceRevisionId !== 
mw.cx.sourceRevision ) {
-   // Show a message to translator that we 
loaded an older revision of
-   // source article.
self.showOldRevisionWarning();
-   // Since we are using older revision, 
use agressive section restore
-   // algorithm.
-   self.oldRevision = true;
}
} );
}, function ( errorCode, details ) {
@@ -206,7 +200,7 @@
if ( !$restoredSection ) {
mw.log( 'Source section not found for ' + 
sourceSectionId );
// Insert right after last matched section if 
possible
-   if ( this.oldRevision && $lastRestoredSection 
&& $lastRestoredSection.length ) {
+   if ( $lastRestoredSection && 
$lastRestoredSection.length ) {
$lastRestoredSection = 
this.addOprhanTranslationUnit(
sourceSectionId, 
$lastRestoredSection, 'after'
);
@@ -219,10 +213,6 @@
$lastRestoredSection = $restoredSection;
// As a last resort, if we did not add orphans 
immediately, add them
// now before this section.
-   if ( !this.oldRevision ) {
-   // Dont use orphan sections unless we 
are using old source article
-   continue;
-   }
for ( i = 0; i < orphans.length; i++ ) {
$lastRestoredSection = 
this.addOprhanTranslationUnit( orphans[ i ], $lastRestoredSection );
if ( $restoredSection && 
$restoredSection.length ) {
@@ -233,7 +223,7 @@
}
}
 
-   if ( orphans.length && !this.oldRevision ) {
+   if ( orphans.length ) {
mw.log( 'Draft restoration failed. Loading older 
revision.' );
window.location = mw.cx.siteMapper.getCXUrl(
mw.cx.sourceTitle,
diff --git a/tests/qunit/translation/ext.cx.translation.loader.test.js 
b/tests/qunit/translation/ext.cx.translation.loader.test.js
index 1a3910a..24055b7 100644
--- a/tests/qunit/translation/ext.cx.translation.loader.test.js
+++ b/tests/qunit/translation/ext.cx.translation.loader.test.js
@@ -52,8 +52,7 @@
QUnit.test( 'Translation daft restore test', function ( assert ) {
var i;
QUnit.expect( tests.length );
-   // Without old revision flag set true, orphan sections wont get 
added.
-   this.translatonLoader.oldRevision = true;
+
for ( i = 0; i < tests.length; i++ ) {
this.translatonLoader.translationUnits = 
this.translatonLoader.getTranslationUnits( tests[ i ].draft );
this.translatonLoader.$sourceColumn = $( tests[ i 
].source );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I66ec5ef18ab339d4921188bb2391596722ec3798
Gerrit-PatchSet: 1
Gerrit-Project: 

[MediaWiki-commits] [Gerrit] Revert "Do not attempt adding orphan section unless source a... - change (mediawiki...ContentTranslation)

2016-03-10 Thread KartikMistry (Code Review)
KartikMistry has uploaded a new change for review.

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

Change subject: Revert "Do not attempt adding orphan section unless source 
article is old revision"
..

Revert "Do not attempt adding orphan section unless source article is old 
revision"

This reverts commit b222dfdbea064718b0953619739df39fd2121ea4.

Change-Id: I66ec5ef18ab339d4921188bb2391596722ec3798
---
M modules/translation/ext.cx.translation.loader.js
M tests/qunit/translation/ext.cx.translation.loader.test.js
2 files changed, 3 insertions(+), 14 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.loader.js 
b/modules/translation/ext.cx.translation.loader.js
index 6a7b493..31a92bb 100644
--- a/modules/translation/ext.cx.translation.loader.js
+++ b/modules/translation/ext.cx.translation.loader.js
@@ -17,7 +17,6 @@
this.$sourceColumn = null;
this.$translationColumn = null;
this.disabled = false;
-   this.oldRevision = false;
}
 
/**
@@ -103,12 +102,7 @@
self.restore();
mw.hook( 'mw.cx.draft.restored' ).fire();
if ( self.translation.sourceRevisionId !== 
mw.cx.sourceRevision ) {
-   // Show a message to translator that we 
loaded an older revision of
-   // source article.
self.showOldRevisionWarning();
-   // Since we are using older revision, 
use agressive section restore
-   // algorithm.
-   self.oldRevision = true;
}
} );
}, function ( errorCode, details ) {
@@ -206,7 +200,7 @@
if ( !$restoredSection ) {
mw.log( 'Source section not found for ' + 
sourceSectionId );
// Insert right after last matched section if 
possible
-   if ( this.oldRevision && $lastRestoredSection 
&& $lastRestoredSection.length ) {
+   if ( $lastRestoredSection && 
$lastRestoredSection.length ) {
$lastRestoredSection = 
this.addOprhanTranslationUnit(
sourceSectionId, 
$lastRestoredSection, 'after'
);
@@ -219,10 +213,6 @@
$lastRestoredSection = $restoredSection;
// As a last resort, if we did not add orphans 
immediately, add them
// now before this section.
-   if ( !this.oldRevision ) {
-   // Dont use orphan sections unless we 
are using old source article
-   continue;
-   }
for ( i = 0; i < orphans.length; i++ ) {
$lastRestoredSection = 
this.addOprhanTranslationUnit( orphans[ i ], $lastRestoredSection );
if ( $restoredSection && 
$restoredSection.length ) {
@@ -233,7 +223,7 @@
}
}
 
-   if ( orphans.length && !this.oldRevision ) {
+   if ( orphans.length ) {
mw.log( 'Draft restoration failed. Loading older 
revision.' );
window.location = mw.cx.siteMapper.getCXUrl(
mw.cx.sourceTitle,
diff --git a/tests/qunit/translation/ext.cx.translation.loader.test.js 
b/tests/qunit/translation/ext.cx.translation.loader.test.js
index 1a3910a..24055b7 100644
--- a/tests/qunit/translation/ext.cx.translation.loader.test.js
+++ b/tests/qunit/translation/ext.cx.translation.loader.test.js
@@ -52,8 +52,7 @@
QUnit.test( 'Translation daft restore test', function ( assert ) {
var i;
QUnit.expect( tests.length );
-   // Without old revision flag set true, orphan sections wont get 
added.
-   this.translatonLoader.oldRevision = true;
+
for ( i = 0; i < tests.length; i++ ) {
this.translatonLoader.translationUnits = 
this.translatonLoader.getTranslationUnits( tests[ i ].draft );
this.translatonLoader.$sourceColumn = $( tests[ i 
].source );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: 

[MediaWiki-commits] [Gerrit] Revert "Do not attempt adding orphan section unless source a... - change (mediawiki...ContentTranslation)

2016-03-10 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Revert "Do not attempt adding orphan section unless source 
article is old revision"
..

Revert "Do not attempt adding orphan section unless source article is old 
revision"

This reverts commit b222dfdbea064718b0953619739df39fd2121ea4.

Change-Id: I66ec5ef18ab339d4921188bb2391596722ec3798
---
M modules/translation/ext.cx.translation.loader.js
M tests/qunit/translation/ext.cx.translation.loader.test.js
2 files changed, 3 insertions(+), 14 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.loader.js 
b/modules/translation/ext.cx.translation.loader.js
index 6a7b493..31a92bb 100644
--- a/modules/translation/ext.cx.translation.loader.js
+++ b/modules/translation/ext.cx.translation.loader.js
@@ -17,7 +17,6 @@
this.$sourceColumn = null;
this.$translationColumn = null;
this.disabled = false;
-   this.oldRevision = false;
}
 
/**
@@ -103,12 +102,7 @@
self.restore();
mw.hook( 'mw.cx.draft.restored' ).fire();
if ( self.translation.sourceRevisionId !== 
mw.cx.sourceRevision ) {
-   // Show a message to translator that we 
loaded an older revision of
-   // source article.
self.showOldRevisionWarning();
-   // Since we are using older revision, 
use agressive section restore
-   // algorithm.
-   self.oldRevision = true;
}
} );
}, function ( errorCode, details ) {
@@ -206,7 +200,7 @@
if ( !$restoredSection ) {
mw.log( 'Source section not found for ' + 
sourceSectionId );
// Insert right after last matched section if 
possible
-   if ( this.oldRevision && $lastRestoredSection 
&& $lastRestoredSection.length ) {
+   if ( $lastRestoredSection && 
$lastRestoredSection.length ) {
$lastRestoredSection = 
this.addOprhanTranslationUnit(
sourceSectionId, 
$lastRestoredSection, 'after'
);
@@ -219,10 +213,6 @@
$lastRestoredSection = $restoredSection;
// As a last resort, if we did not add orphans 
immediately, add them
// now before this section.
-   if ( !this.oldRevision ) {
-   // Dont use orphan sections unless we 
are using old source article
-   continue;
-   }
for ( i = 0; i < orphans.length; i++ ) {
$lastRestoredSection = 
this.addOprhanTranslationUnit( orphans[ i ], $lastRestoredSection );
if ( $restoredSection && 
$restoredSection.length ) {
@@ -233,7 +223,7 @@
}
}
 
-   if ( orphans.length && !this.oldRevision ) {
+   if ( orphans.length ) {
mw.log( 'Draft restoration failed. Loading older 
revision.' );
window.location = mw.cx.siteMapper.getCXUrl(
mw.cx.sourceTitle,
diff --git a/tests/qunit/translation/ext.cx.translation.loader.test.js 
b/tests/qunit/translation/ext.cx.translation.loader.test.js
index 1a3910a..24055b7 100644
--- a/tests/qunit/translation/ext.cx.translation.loader.test.js
+++ b/tests/qunit/translation/ext.cx.translation.loader.test.js
@@ -52,8 +52,7 @@
QUnit.test( 'Translation daft restore test', function ( assert ) {
var i;
QUnit.expect( tests.length );
-   // Without old revision flag set true, orphan sections wont get 
added.
-   this.translatonLoader.oldRevision = true;
+
for ( i = 0; i < tests.length; i++ ) {
this.translatonLoader.translationUnits = 
this.translatonLoader.getTranslationUnits( tests[ i ].draft );
this.translatonLoader.$sourceColumn = $( tests[ i 
].source );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66ec5ef18ab339d4921188bb2391596722ec3798