Merge "Fix regular expression"
[lhc/web/wiklou.git] / includes / skins / Skin.php
index 91d2a7e..809d411 100644 (file)
@@ -196,14 +196,15 @@ abstract class Skin extends ContextSource {
                        'core' => [
                                'site',
                                'mediawiki.page.startup',
-                               'mediawiki.user',
                        ],
                        // modules that enhance the content in some way
                        'content' => [
                                'mediawiki.page.ready',
                        ],
                        // modules relating to search functionality
-                       'search' => [],
+                       'search' => [
+                               'mediawiki.searchSuggest',
+                       ],
                        // modules relating to functionality relating to watching an article
                        'watch' => [],
                        // modules which relate to the current users preferences
@@ -242,8 +243,6 @@ abstract class Skin extends ContextSource {
                        $modules['watch'][] = 'mediawiki.page.watch.ajax';
                }
 
-               $modules['search'][] = 'mediawiki.searchSuggest';
-
                if ( $user->getBoolOption( 'editsectiononrightclick' ) ) {
                        $modules['user'][] = 'mediawiki.action.view.rightClickEdit';
                }
@@ -438,6 +437,7 @@ abstract class Skin extends ContextSource {
         */
        function getPageClasses( $title ) {
                $numeric = 'ns-' . $title->getNamespace();
+               $user = $this->getUser();
 
                if ( $title->isSpecialPage() ) {
                        $type = 'ns-special';
@@ -449,10 +449,16 @@ abstract class Skin extends ContextSource {
                        } else {
                                $type .= ' mw-invalidspecialpage';
                        }
-               } elseif ( $title->isTalkPage() ) {
-                       $type = 'ns-talk';
                } else {
-                       $type = 'ns-subject';
+                       if ( $title->isTalkPage() ) {
+                               $type = 'ns-talk';
+                       } else {
+                               $type = 'ns-subject';
+                       }
+                       // T208315: add HTML class when the user can edit the page
+                       if ( $title->quickUserCan( 'edit', $user ) ) {
+                               $type .= ' mw-editable';
+                       }
                }
 
                $name = Sanitizer::escapeClass( 'page-' . $title->getPrefixedText() );
@@ -1554,7 +1560,7 @@ abstract class Skin extends ContextSource {
                        // TTL in seconds
                        600,
                        function () use ( $notice ) {
-                               return $this->getOutput()->parse( $notice );
+                               return $this->getOutput()->parseAsInterface( $notice );
                        }
                );