To improve in the future:
* Check the rights on the target wiki rather than current, they might
not be the same
* Use a better error message when not all logged-in users can upload
Bug: T115866
Change-Id: I6f68122b5399f4b8766825c752e964478ae7563d
),
'dependencies' => array(
'oojs-ui',
+ 'mediawiki.user',
'mediawiki.Upload',
'mediawiki.jqueryMsg',
),
content: [ this.insertForm ]
} )
] );
+
+ // If the user can't upload anything, don't give them the option to
+ // TODO Check the rights on the target wiki rather than current, they might not be the same
+ mw.user.getRights().done( function ( rights ) {
+ if ( rights.indexOf( 'upload' ) === -1 ) {
+ this.getPage( 'upload' ).$element
+ .empty()
+ // TODO Use a better error message when not all logged-in users can upload
+ .msg( 'api-error-mustbeloggedin' );
+ }
+ }.bind( this ) );
};
/* Setup */