Fix user rights check to display the "revert" link on file histories.
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Tue, 29 May 2012 17:09:01 +0000 (19:09 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Tue, 29 May 2012 17:09:01 +0000 (19:09 +0200)
* Don't do expensive checks for display (for the consistency of the interface)
* Removed the logged-in check and changed it for 'upload' right (as the user need this right to execute the action)

Change-Id: Ie5752e5292a953cbcf81ab665365c3efbd4eba6a

includes/ImagePage.php

index 22984a5..63e9894 100644 (file)
@@ -1038,7 +1038,9 @@ class ImageHistoryList extends ContextSource {
                $row .= '<td>';
                if ( $iscur ) {
                        $row .= wfMsgHtml( 'filehist-current' );
-               } elseif ( $local && $user->isLoggedIn() && $this->title->userCan( 'edit' ) ) {
+               } elseif ( $local && $this->title->quickUserCan( 'edit' )
+                       && $this->title->quickUserCan( 'upload' )
+               ) {
                        if ( $file->isDeleted( File::DELETED_FILE ) ) {
                                $row .= wfMsgHtml( 'filehist-revert' );
                        } else {