Nischayn22 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/50755
Change subject: (bug 40920) handle redirects for license templates
......................................................................
(bug 40920) handle redirects for license templates
Change-Id: If8d864d2cb179f2df43cf470187253b6145830c7
---
M resources/mw.UploadWizardLicenseInput.js
1 file changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard
refs/changes/55/50755/1
diff --git a/resources/mw.UploadWizardLicenseInput.js
b/resources/mw.UploadWizardLicenseInput.js
index 6f3b7fb..9867609 100644
--- a/resources/mw.UploadWizardLicenseInput.js
+++ b/resources/mw.UploadWizardLicenseInput.js
@@ -528,6 +528,25 @@
// TODO caching
var found = false;
+
+ // Handling redirects as per bug 40920
+ function handleRedirects( title ) {
+ var api = new mw.Api();
+ api.get( {
+ action: 'query',
+ titles: title.getPrefixedDb(),
+ redirects: ''
+ }, {
+ ok: function ( data ) {
+ if ( data.query.redirects ) {
+ title = new mw.Title(
data.query.redirects[0]['to'] );
+ console.log( 'fn' + title );
+ }
+ },
+ async: false
+ } );
+ }
+
function recurseCategories( desiredCatTitle, title,
depthToContinue ) {
if ( depthToContinue === 0 ) {
return;
@@ -553,6 +572,7 @@
$.each( templates, function( i, t ) {
var title = new mw.Title( t, templateNsId );
+ handleRedirects( title );
recurseCategories( licenseCategory, title, 5 );
if ( found ) {
return false;
--
To view, visit https://gerrit.wikimedia.org/r/50755
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If8d864d2cb179f2df43cf470187253b6145830c7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Nischayn22 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits