Move construction of highlight divs to backend
[lhc/web/wiklou.git] / includes / changes / EnhancedChangesList.php
index 0df6828..0c56fdd 100644 (file)
@@ -203,8 +203,7 @@ class EnhancedChangesList extends ChangesList {
                # Default values for RC flags
                $collectedRcFlags = [];
                foreach ( $recentChangesFlags as $key => $value ) {
-                       $flagGrouping = ( isset( $recentChangesFlags[$key]['grouping'] ) ?
-                                       $recentChangesFlags[$key]['grouping'] : 'any' );
+                       $flagGrouping = ( $recentChangesFlags[$key]['grouping'] ?? 'any' );
                        switch ( $flagGrouping ) {
                                case 'all':
                                        $collectedRcFlags[$key] = true;
@@ -277,8 +276,7 @@ class EnhancedChangesList extends ChangesList {
 
                        // Roll up flags
                        foreach ( $line['recentChangesFlagsRaw'] as $key => $value ) {
-                               $flagGrouping = ( isset( $recentChangesFlags[$key]['grouping'] ) ?
-                                       $recentChangesFlags[$key]['grouping'] : 'any' );
+                               $flagGrouping = ( $recentChangesFlags[$key]['grouping'] ?? 'any' );
                                switch ( $flagGrouping ) {
                                        case 'all':
                                                if ( !$value ) {
@@ -324,7 +322,7 @@ class EnhancedChangesList extends ChangesList {
                                $first--;
                        }
                        # Get net change
-                       $charDifference = $this->formatCharacterDifference( $block[$first], $block[$last] );
+                       $charDifference = $this->formatCharacterDifference( $block[$first], $block[$last] ) ?: false;
                }
 
                $numberofWatchingusers = $this->numberofWatchingusers( $block[0]->numberofWatchingusers );
@@ -707,9 +705,14 @@ class EnhancedChangesList extends ChangesList {
                }
 
                $line = Html::openElement( 'table', $attribs ) . Html::openElement( 'tr' );
+               // Highlight block
+               $line .= Html::rawElement( 'td', [],
+                       $this->getHighlightsContainerDiv()
+               );
+
                $line .= Html::rawElement( 'td', [], '<span class="mw-enhancedchanges-arrow-space"></span>' );
                $line .= Html::rawElement( 'td', [ 'class' => 'mw-changeslist-line-prefix' ], $prefix );
-               $line .= '<td class="mw-enhanced-rc">';
+               $line .= '<td class="mw-enhanced-rc" colspan="2">';
 
                if ( isset( $data['recentChangesFlags'] ) ) {
                        $line .= $this->recentChangesFlags( $data['recentChangesFlags'] );
@@ -717,10 +720,10 @@ class EnhancedChangesList extends ChangesList {
                }
 
                if ( isset( $data['timestampLink'] ) ) {
-                       $line .= '&#160;' . $data['timestampLink'];
+                       $line .= "\u{00A0}" . $data['timestampLink'];
                        unset( $data['timestampLink'] );
                }
-               $line .= '&#160;</td>';
+               $line .= "\u{00A0}</td>";
                $line .= Html::openElement( 'td', [
                        'class' => 'mw-changeslist-line-inner',
                        // Used for reliable determination of the affiliated page