mw.ForeignStructuredUpload: Add '{{Uncategorized}}' template if no categories given
authorBartosz Dziewoński <matma.rex@gmail.com>
Tue, 15 Dec 2015 16:10:07 +0000 (17:10 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 15 Dec 2015 16:10:07 +0000 (17:10 +0100)
This is not configurable at the moment. It probably should be, but
that can be done later.

Bug: T121268
Change-Id: I8de33a69979eff5dba13f82959011c44a92339e1

resources/src/mediawiki/mediawiki.ForeignStructuredUpload.js

index 0117cea..768efc3 100644 (file)
        ForeignStructuredUpload.prototype.getCategories = function () {
                var i, cat, categoryLinks = [];
 
+               if ( this.categories.length === 0 ) {
+                       return '{{subst:unc}}';
+               }
+
                for ( i = 0; i < this.categories.length; i++ ) {
                        cat = this.categories[ i ];
                        categoryLinks.push( '[[Category:' + cat + ']]' );