Santhosh has uploaded a new change for review.

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

Change subject: Make sure CX know the revision id
......................................................................

Make sure CX know the revision id

This is to start supporting RESTBase page fetch(T92359)
till T97393 is fixed.

Bug: T97393
Change-Id: Ib15c15ff656212bbf1032d1f30d591c83d2997a8
---
M modules/source/ext.cx.source.js
1 file changed, 9 insertions(+), 0 deletions(-)


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

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index b767d61..b2d54a0 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -137,11 +137,20 @@
        };
 
        ContentTranslationSource.prototype.load = function ( content ) {
+               var revision;
+
                this.$content.html( content.segmentedContent );
 
                // @todo figure out what should be done here
                this.$content.find( 'base' ).detach();
 
+               if ( !mw.cx.sourceRevision ) {
+                       // Make sure we know the revision id.
+                       // Restbase cannot give the revision id of the page we 
requested.
+                       // TODO: Remove once 
https://phabricator.wikimedia.org/T97393 resolved.
+                       revision = $( 'link[rel="dc:replaces"]' ).attr( 
'resource' );
+                       mw.cx.sourceRevision = revision && revision.split( '/' 
)[ 1 ];
+               }
                mw.hook( 'mw.cx.source.ready' ).fire();
        };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib15c15ff656212bbf1032d1f30d591c83d2997a8
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