jenkins-bot has submitted this change and it was merged.
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, 8 insertions(+), 10 deletions(-)
Approvals:
Nikerabbit: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/tools/ext.cx.tools.link.js
b/modules/tools/ext.cx.tools.link.js
index c471117..91e4f5c 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -62,6 +62,10 @@
var apiLanguage,
deferred = $.Deferred();
+ if ( !titles || !titles.length ) {
+ return deferred.resolve( {} ).promise();
+ }
+
if ( !$.isArray( titles ) ) {
titles = new Array( titles );
}
@@ -906,16 +910,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: merged
Gerrit-Change-Id: I37023ebe7110a2b8a53cdceae8de7a66e855f3d2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits