Merge "Fix 'Tags' padding to keep it farther from the edge and document the source...
[lhc/web/wiklou.git] / includes / changes / ChangesList.php
index 5b8559e..57c4026 100644 (file)
@@ -115,6 +115,31 @@ class ChangesList extends ContextSource {
                throw new RuntimeException( 'recentChangesLine should be implemented' );
        }
 
+       /**
+        * Get the container for highlights that are used in the new StructuredFilters
+        * system
+        *
+        * @return string HTML structure of the highlight container div
+        */
+       protected function getHighlightsContainerDiv() {
+               $highlightColorDivs = '';
+               foreach ( [ 'none', 'c1', 'c2', 'c3', 'c4', 'c5' ] as $color ) {
+                       $highlightColorDivs .= Html::rawElement(
+                               'div',
+                               [
+                                       'class' => 'mw-rcfilters-ui-highlights-color-' . $color,
+                                       'data-color' => $color
+                               ]
+                       );
+               }
+
+               return Html::rawElement(
+                       'div',
+                       [ 'class' => 'mw-rcfilters-ui-highlights' ],
+                       $highlightColorDivs
+               );
+       }
+
        /**
         * Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag
         * @param bool $value
@@ -152,7 +177,7 @@ class ChangesList extends ContextSource {
         * @param string $nothing To use for empty space
         * @return string
         */
-       public function recentChangesFlags( $flags, $nothing = '&#160;' ) {
+       public function recentChangesFlags( $flags, $nothing = "\u{00A0}" ) {
                $f = '';
                foreach ( array_keys( $this->getConfig()->get( 'RecentChangesFlags' ) ) as $flag ) {
                        $f .= isset( $flags[$flag] ) && $flags[$flag]
@@ -183,8 +208,6 @@ class ChangesList extends ContextSource {
                        $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns' .
                                $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
                }
-               $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns-' .
-                       $rc->mAttribs['rc_namespace'] );
 
                // Indicate watched status on the line to allow for more
                // comprehensive styling.
@@ -198,7 +221,8 @@ class ChangesList extends ContextSource {
        }
 
        /**
-        * Get an array of CSS classes attributed to filters for this row
+        * Get an array of CSS classes attributed to filters for this row. Used for highlighting
+        * in the front-end.
         *
         * @param RecentChange $rc
         * @return array Array of CSS classes
@@ -206,6 +230,9 @@ class ChangesList extends ContextSource {
        protected function getHTMLClassesForFilters( $rc ) {
                $classes = [];
 
+               $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns-' .
+                       $rc->mAttribs['rc_namespace'] );
+
                if ( $this->filterGroups !== null ) {
                        foreach ( $this->filterGroups as $filterGroup ) {
                                foreach ( $filterGroup->getFilters() as $filter ) {
@@ -236,7 +263,7 @@ class ChangesList extends ContextSource {
                                $flagInfos[$key]['letter'] = $value['letter'];
                                $flagInfos[$key]['title'] = $value['title'];
                                // Allow customized class name, fall back to flag name
-                               $flagInfos[$key]['class'] = isset( $value['class'] ) ? $value['class'] : $key;
+                               $flagInfos[$key]['class'] = $value['class'] ?? $key;
                        }
                }
 
@@ -646,6 +673,7 @@ class ChangesList extends ContextSource {
                                        'id' => $rc->mAttribs['rc_this_oldid'],
                                        'user' => $rc->mAttribs['rc_user'],
                                        'user_text' => $rc->mAttribs['rc_user_text'],
+                                       'actor' => $rc->mAttribs['rc_actor'] ?? null,
                                        'deleted' => $rc->mAttribs['rc_deleted']
                                ] );
                                $s .= ' ' . Linker::generateRollback( $rev, $this->getContext() );