For consistency of the interface, don't do expensive checks on page view.
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Sat, 14 Jul 2012 19:30:49 +0000 (21:30 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Sat, 14 Jul 2012 19:30:49 +0000 (21:30 +0200)
Also replaced two $this->getUser() calls with $user since that variable is
already in that method.

Change-Id: Iccda9f44a9cf6d3187895a8b6111bc62dca1e811

includes/actions/HistoryAction.php

index 7393315..1dacabc 100644 (file)
@@ -618,10 +618,8 @@ class HistoryPager extends ReverseChronologicalPager {
                $tools = array();
 
                # Rollback and undo links
-               if ( $prevRev &&
-                       !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) ) )
-               {
-                       if ( $latest && !count( $this->getTitle()->getUserPermissionsErrors( 'rollback', $this->getUser() ) ) ) {
+               if ( $prevRev && $this->getTitle()->quickUserCan( 'edit', $user ) ) {
+                       if ( $latest && $this->getTitle()->quickUserCan( 'rollback', $user ) ) {
                                $this->preventClickjacking();
                                $tools[] = '<span class="mw-rollback-link">' .
                                        Linker::buildRollbackLink( $rev, $this->getContext() ) . '</span>';