Santhosh has uploaded a new change for review.

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

Change subject: Link cards does not work on sections restored from draft
......................................................................

Link cards does not work on sections restored from draft

Fetch the link data for links in the sections restored from draft.

Testplan:
Do some translation. Save. Restore. Click on the links in the restored
section. Link tools should work without any difference.

Change-Id: I37023ebe7110a2b8a53cdceae8de7a66e855f3d2
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 9 insertions(+), 10 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index c471117..7946e9c 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -62,6 +62,11 @@
                var apiLanguage,
                        deferred = $.Deferred();
 
+               if ( !titles || !titles.length ) {
+                       deferred.resolve( {} );
+                       return;
+               }
+
                if ( !$.isArray( titles ) ) {
                        titles = new Array( titles );
                }
@@ -906,16 +911,10 @@
                $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
                $sourceLinks = $sourceSection.find( 'a[rel="mw:WikiLink"]' );
 
-               if ( !$section.data( 'cx-draft' ) ) {
-                       // Collect all source links' titles
-                       sourceLinkTargets = $sourceLinks.map( function () {
-                               return $( this ).attr( 'title' );
-                       } ).get();
-               }
-
-               if ( !sourceLinkTargets.length ) {
-                       return;
-               }
+               // Collect all source links' titles
+               sourceLinkTargets = $sourceLinks.map( function () {
+                       return $( this ).attr( 'title' );
+               } ).get();
 
                $targetLinks = $section.find( 'a[rel="mw:WikiLink"]' );
 

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

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

Reply via email to