Check supportsDirectEditing when suggesting page creation
authorMarius Hoch <hoo@online.de>
Fri, 21 Apr 2017 15:06:51 +0000 (17:06 +0200)
committerMarius Hoch <hoo@online.de>
Fri, 21 Apr 2017 15:20:25 +0000 (17:20 +0200)
on Special:Search.

If the linked page is not going to be editable directly,
rather not suggest the user to create it.

Bug: T58032
Change-Id: I28f16c93b8efd9bfa360e3f9c6d6e65e5a927c42

includes/specials/SpecialSearch.php

index 139e4f7..3a93107 100644 (file)
@@ -475,7 +475,9 @@ class SpecialSearch extends SpecialPage {
                        if ( $title->isKnown() ) {
                                $messageName = 'searchmenu-exists';
                                $linkClass = 'mw-search-exists';
-                       } elseif ( $title->quickUserCan( 'create', $this->getUser() ) ) {
+                       } elseif ( ContentHandler::getForTitle( $title )->supportsDirectEditing()
+                               && $title->quickUserCan( 'create', $this->getUser() )
+                       ) {
                                $messageName = 'searchmenu-new';
                        }
                }