Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/248101

Change subject: mediawiki.Upload.BookletLayout: If the user can't upload 
anything, don't give them the option to
......................................................................

mediawiki.Upload.BookletLayout: If the user can't upload anything, don't give 
them the option to

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
---
M resources/src/mediawiki/mediawiki.Upload.BookletLayout.js
1 file changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/01/248101/1

diff --git a/resources/src/mediawiki/mediawiki.Upload.BookletLayout.js 
b/resources/src/mediawiki/mediawiki.Upload.BookletLayout.js
index dd199ce..0a1121b 100644
--- a/resources/src/mediawiki/mediawiki.Upload.BookletLayout.js
+++ b/resources/src/mediawiki/mediawiki.Upload.BookletLayout.js
@@ -88,6 +88,17 @@
                                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 */

-- 
To view, visit https://gerrit.wikimedia.org/r/248101
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f68122b5399f4b8766825c752e964478ae7563d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to