2 * MediaWiki Widgets - MediaUserUploadsQueue class.
4 * @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
5 * @license The MIT License (MIT); see LICENSE.txt
10 * @classdesc Media resource queue.
13 * @extends mw.widgets.MediaResourceQueue
16 * @description Create an instance of `mw.widgets.MediaUserUploadsQueue`.
17 * @param {Object} [config] Configuration options
18 * @param {number} config.maxHeight The maximum height of the media, used in the
19 * search call to the API.
21 mw.widgets.MediaUserUploadsQueue = function MwWidgetsMediaUserUploadsQueue( config ) {
22 config = config || {};
25 mw.widgets.MediaUserUploadsQueue.super.call( this, config );
27 if ( !mw.user.isAnon() ) {
28 this.setUser( mw.user.getName() );
33 OO.inheritClass( mw.widgets.MediaUserUploadsQueue, mw.widgets.MediaResourceQueue );
36 * Override parent method to set up the providers according to
39 * @return {jQuery.Promise} Promise that resolves when the resources are set up
41 mw.widgets.MediaUserUploadsQueue.prototype.setup = function () {
42 return this.getFileRepos().then( ( sources ) => {
43 if ( this.providers.length === 0 ) {
44 // Set up the providers
45 for ( let i = 0, len = sources.length; i < len; i++ ) {
46 this.addProvider( new mw.widgets.MediaUserUploadsProvider(
49 name: sources[ i ].name,
50 local: sources[ i ].local,
51 scriptDirUrl: sources[ i ].scriptDirUrl,
53 gaiuser: this.getUser()
56 iiurlheight: this.getMaxHeight()
68 * @param {string} user User name
70 mw.widgets.MediaUserUploadsQueue.prototype.setUser = function ( user ) {
71 this.setParams( { gaiuser: user } );
77 * @return {string} API search query
79 mw.widgets.MediaUserUploadsQueue.prototype.getUser = function () {
80 return this.getParams().gaiuser;