Remove $wgAjaxWatch configuration variable
[lhc/web/wiklou.git] / includes / skins / Skin.php
index 53af3e7..12ebb54 100644 (file)
@@ -180,7 +180,7 @@ abstract class Skin extends ContextSource {
         * @return array Array of modules with helper keys for easy overriding
         */
        public function getDefaultModules() {
-               global $wgUseAjax, $wgAjaxWatch, $wgEnableAPI, $wgEnableWriteAPI;
+               global $wgUseAjax, $wgEnableAPI, $wgEnableWriteAPI;
 
                $out = $this->getOutput();
                $user = $out->getUser();
@@ -200,16 +200,15 @@ abstract class Skin extends ContextSource {
                );
 
                // Add various resources if required
-               if ( $wgUseAjax ) {
-                       if ( $wgEnableAPI ) {
-                               if ( $wgEnableWriteAPI && $wgAjaxWatch && $user->isLoggedIn()
-                                       && $user->isAllowed( 'writeapi' )
-                               ) {
-                                       $modules['watch'][] = 'mediawiki.page.watch.ajax';
-                               }
-
-                               $modules['search'][] = 'mediawiki.searchSuggest';
+               if ( $wgUseAjax && $wgEnableAPI ) {
+                       if ( $wgEnableWriteAPI && $user->isLoggedIn()
+                               && $user->isAllowedAll( 'writeapi', 'viewmywatchlist', 'editmywatchlist' )
+                               && $this->getRelevantTitle()->canExist()
+                       ) {
+                               $modules['watch'][] = 'mediawiki.page.watch.ajax';
                        }
+
+                       $modules['search'][] = 'mediawiki.searchSuggest';
                }
 
                if ( $user->getBoolOption( 'editsectiononrightclick' ) ) {
@@ -238,8 +237,8 @@ abstract class Skin extends ContextSource {
                        $titles[] = $user->getTalkPage();
                }
 
-               // Other tab link
-               if ( $title->isSpecialPage() ) {
+               // Check, if the page can hold some kind of content, otherwise do nothing
+               if ( !$title->canExist() ) {
                        // nothing
                } elseif ( $title->isTalkPage() ) {
                        $titles[] = $title->getSubjectPage();