Merge "For consistency of the interface, don't do expensive checks on page view."
[lhc/web/wiklou.git] / includes / Article.php
index 4b67ea7..dcde2cf 100644 (file)
@@ -496,7 +496,7 @@ class Article extends Page {
                if ( $outputPage->isPrintable() ) {
                        $parserOptions->setIsPrintable( true );
                        $parserOptions->setEditSection( false );
-               } elseif ( !$this->isCurrent() || !$this->getTitle()->quickUserCan( 'edit' ) ) {
+               } elseif ( !$this->isCurrent() || !$this->getTitle()->quickUserCan( 'edit', $user ) ) {
                        $parserOptions->setEditSection( false );
                }
 
@@ -956,7 +956,7 @@ class Article extends Page {
                $user = $this->getContext()->getUser();
                $rcid = $request->getVal( 'rcid' );
 
-               if ( !$rcid || !$this->getTitle()->quickUserCan( 'patrol' ) ) {
+               if ( !$rcid || !$this->getTitle()->quickUserCan( 'patrol', $user ) ) {
                        return;
                }
 
@@ -1133,9 +1133,11 @@ class Article extends Page {
 
                $current = ( $oldid == $this->mPage->getLatest() );
                $language = $this->getContext()->getLanguage();
-               $td = $language->timeanddate( $timestamp, true );
-               $tddate = $language->date( $timestamp, true );
-               $tdtime = $language->time( $timestamp, true );
+               $user = $this->getContext()->getUser();
+
+               $td = $language->userTimeAndDate( $timestamp, $user );
+               $tddate = $language->userDate( $timestamp, $user );
+               $tdtime = $language->userTime( $timestamp, $user );
 
                # Show user links if allowed to see them. If hidden, then show them only if requested...
                $userlinks = Linker::revUserTools( $revision, !$unhide );
@@ -1220,7 +1222,7 @@ class Article extends Page {
                                array( 'known', 'noclasses' )
                        );
 
-               $cdel = Linker::getRevDeleteLink( $this->getContext()->getUser(), $revision, $this->getTitle() );
+               $cdel = Linker::getRevDeleteLink( $user, $revision, $this->getTitle() );
                if ( $cdel !== '' ) {
                        $cdel .= ' ';
                }
@@ -1368,9 +1370,9 @@ class Article extends Page {
                        $this->doDelete( $reason, $suppress );
 
                        if ( $request->getCheck( 'wpWatch' ) && $user->isLoggedIn() ) {
-                               $this->doWatch();
+                               WatchAction::doWatch( $title, $user );
                        } elseif ( $title->userIsWatching() ) {
-                               $this->doUnwatch();
+                               WatchAction::doUnwatch( $title, $user );
                        }
 
                        return;
@@ -1402,7 +1404,7 @@ class Article extends Page {
                        }
                }
 
-               return $this->confirmDelete( $reason );
+               $this->confirmDelete( $reason );
        }
 
        /**