-/*global moment*/
+/* global moment*/
( function ( $, mw, moment ) {
/**
return this.upload.getApi().then(
function ( api ) {
- return $.when(
- booklet.upload.loadConfig().then(
- null,
- function ( errorMsg ) {
- booklet.getPage( 'upload' ).$element.msg( errorMsg );
- return $.Deferred().resolve();
- }
- ),
- // If the user can't upload anything, don't give them the option to.
- api.getUserInfo().then( function ( userInfo ) {
+ // If the user can't upload anything, don't give them the option to.
+ return api.getUserInfo().then(
+ function ( userInfo ) {
if ( userInfo.rights.indexOf( 'upload' ) === -1 ) {
- // TODO Use a better error message when not all logged-in users can upload
- booklet.getPage( 'upload' ).$element.msg( 'api-error-mustbeloggedin' );
+ if ( mw.user.isAnon() ) {
+ booklet.getPage( 'upload' ).$element.msg( 'api-error-mustbeloggedin' );
+ } else {
+ booklet.getPage( 'upload' ).$element.msg( 'api-error-badaccess-groups' );
+ }
}
return $.Deferred().resolve();
- } )
- ).then(
- null,
+ },
// Always resolve, never reject
function () { return $.Deferred().resolve(); }
);