Merge "ContribsPage: Re-remove the getContribs() method"
[lhc/web/wiklou.git] / includes / changes / ChangesList.php
index d97abca..0382d73 100644 (file)
@@ -232,6 +232,13 @@ class ChangesList extends ContextSource {
                $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns-' .
                        $rc->mAttribs['rc_namespace'] );
 
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
+               $classes[] = Sanitizer::escapeClass(
+                       self::CSS_CLASS_PREFIX .
+                       'ns-' .
+                       ( $nsInfo->isTalk( $rc->mAttribs['rc_namespace'] ) ? 'talk' : 'subject' )
+               );
+
                if ( $this->filterGroups !== null ) {
                        foreach ( $this->filterGroups as $filterGroup ) {
                                foreach ( $filterGroup->getFilters() as $filter ) {
@@ -451,9 +458,9 @@ class ChangesList extends ContextSource {
        public function insertLog( &$s, $title, $logtype ) {
                $page = new LogPage( $logtype );
                $logname = $page->getName()->setContext( $this->getContext() )->text();
-               $s .= $this->msg( 'parentheses' )->rawParams(
-                       $this->linkRenderer->makeKnownLink( $title, $logname )
-               )->escaped();
+               $s .= Html::rawElement( 'span', [
+                       'class' => 'mw-changeslist-links'
+               ], $this->linkRenderer->makeKnownLink( $title, $logname ) );
        }
 
        /**
@@ -605,7 +612,9 @@ class ChangesList extends ContextSource {
                $formatter->setShowUserToolLinks( true );
                $mark = $this->getLanguage()->getDirMark();
 
-               return $formatter->getActionText() . " $mark" . $formatter->getComment();
+               return Html::openElement( 'span', [ 'class' => 'mw-changeslist-log-entry' ] )
+                       . $formatter->getActionText() . " $mark" . $formatter->getComment()
+                       . Html::closeElement( 'span' );
        }
 
        /**
@@ -662,15 +671,20 @@ class ChangesList extends ContextSource {
         * field of this revision, if it's marked as deleted.
         * @param RCCacheEntry|RecentChange $rc
         * @param int $field
-        * @param User|null $user User object to check, or null to use $wgUser
+        * @param User|null $user User object to check against. If null, the global RequestContext's
+        * User is assumed instead.
         * @return bool
         */
        public static function userCan( $rc, $field, User $user = null ) {
+               if ( $user === null ) {
+                       $user = RequestContext::getMain()->getUser();
+               }
+
                if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
                        return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
-               } else {
-                       return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
                }
+
+               return RevisionRecord::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
        }
 
        /**
@@ -700,8 +714,11 @@ class ChangesList extends ContextSource {
                ) {
                        $title = $rc->getTitle();
                        /** Check for rollback permissions, disallow special pages, and only
-                        * show a link on the top-most revision */
-                       if ( $title->quickUserCan( 'rollback', $this->getUser() ) ) {
+                        * show a link on the top-most revision
+                        */
+                       if ( MediaWikiServices::getInstance()->getPermissionManager()
+                               ->quickUserCan( 'rollback', $this->getUser(), $title )
+                       ) {
                                $rev = new Revision( [
                                        'title' => $title,
                                        'id' => $rc->mAttribs['rc_this_oldid'],