Ferveo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/279956

Change subject: Mark watched links to articles in QueryPage-children pages
......................................................................

Mark watched links to articles in QueryPage-children pages

As reported in T18922 some special pages list watched pages in bold while
other do not. Adding general mechanism to allow easy marking of user
watched articles to all QueryPage descendant special pages.
This change adds a style (as defined in .mw-watched-item) to watched links
in these special pages:
DeadendPages, ShortPages, LongPages, LonelyPages, Uncategorizedpages,
Withoutinterwiki

Bug: T18922
Change-Id: Ib1186301cbcc9235cf344a571c0af1698865b5a2
---
M includes/specialpage/PageQueryPage.php
M includes/specialpage/QueryPage.php
M includes/specials/SpecialDeadendpages.php
M includes/specials/SpecialLonelypages.php
M includes/specials/SpecialShortpages.php
M includes/specials/SpecialUncategorizedpages.php
M includes/specials/SpecialWithoutinterwiki.php
M resources/src/mediawiki.special/mediawiki.special.css
8 files changed, 82 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/56/279956/1

diff --git a/includes/specialpage/PageQueryPage.php 
b/includes/specialpage/PageQueryPage.php
index 97f004f..ef24af6 100644
--- a/includes/specialpage/PageQueryPage.php
+++ b/includes/specialpage/PageQueryPage.php
@@ -63,7 +63,11 @@
 
                if ( $title instanceof Title ) {
                        $text = $wgContLang->convert( $title->getPrefixedText() 
);
-                       return Linker::link( $title, htmlspecialchars( $text ) 
);
+                       return Linker::link(
+                               $title,
+                               htmlspecialchars( $text ),
+                               empty( $row->watched ) ? [] : [ 'class' => 
'mw-watched-item' ]
+                       );
                } else {
                        return Html::element( 'span', [ 'class' => 
'mw-invalidtitle' ],
                                Linker::getInvalidTitleDescription( 
$this->getContext(), $row->namespace, $row->title ) );
diff --git a/includes/specialpage/QueryPage.php 
b/includes/specialpage/QueryPage.php
index 2523810..3eaddcc 100644
--- a/includes/specialpage/QueryPage.php
+++ b/includes/specialpage/QueryPage.php
@@ -557,6 +557,7 @@
                $this->outputHeader();
 
                $out = $this->getOutput();
+               $out->addModules( 'mediawiki.special' );
 
                if ( $this->isCached() && !$this->isCacheable() ) {
                        $out->addWikiMsg( 'querypage-disabled' );
diff --git a/includes/specials/SpecialDeadendpages.php 
b/includes/specials/SpecialDeadendpages.php
index f13f231..842fd4b 100644
--- a/includes/specials/SpecialDeadendpages.php
+++ b/includes/specials/SpecialDeadendpages.php
@@ -58,11 +58,12 @@
 
        function getQueryInfo() {
                return [
-                       'tables' => [ 'page', 'pagelinks' ],
+                       'tables' => [ 'page', 'pagelinks', 'watchlist' ],
                        'fields' => [
                                'namespace' => 'page_namespace',
                                'title' => 'page_title',
-                               'value' => 'page_title'
+                               'value' => 'page_title',
+                               'watched' => 'wl_user'
                        ],
                        'conds' => [
                                'pl_from IS NULL',
@@ -73,6 +74,14 @@
                                'pagelinks' => [
                                        'LEFT JOIN',
                                        [ 'page_id=pl_from' ]
+                               ],
+                               'watchlist' => [
+                                       'LEFT JOIN',
+                                       [
+                                               'wl_user=' . 
$this->getUser()->getId(),
+                                               'wl_title=page_title',
+                                               'wl_namespace=page_namespace'
+                                       ]
                                ]
                        ]
                ];
diff --git a/includes/specials/SpecialLonelypages.php 
b/includes/specials/SpecialLonelypages.php
index ff76a4b..196ba24 100644
--- a/includes/specials/SpecialLonelypages.php
+++ b/includes/specials/SpecialLonelypages.php
@@ -49,7 +49,7 @@
        }
 
        function getQueryInfo() {
-               $tables = [ 'page', 'pagelinks', 'templatelinks' ];
+               $tables = [ 'page', 'pagelinks', 'templatelinks', 'watchlist' ];
                $conds = [
                        'pl_namespace IS NULL',
                        'page_namespace' => MWNamespace::getContentNamespaces(),
@@ -68,6 +68,14 @@
                                        'tl_namespace = page_namespace',
                                        'tl_title = page_title'
                                ]
+                       ],
+                       'watchlist' => [
+                               'LEFT JOIN',
+                               [
+                                       'wl_user=' . $this->getUser()->getId(),
+                                       'wl_title=page_title',
+                                       'wl_namespace=page_namespace'
+                               ]
                        ]
                ];
 
@@ -79,7 +87,8 @@
                        'fields' => [
                                'namespace' => 'page_namespace',
                                'title' => 'page_title',
-                               'value' => 'page_title'
+                               'value' => 'page_title',
+                               'watched' => 'wl_user'
                        ],
                        'conds' => $conds,
                        'join_conds' => $joinConds
diff --git a/includes/specials/SpecialShortpages.php 
b/includes/specials/SpecialShortpages.php
index 20f2fc8..5c1003e 100644
--- a/includes/specials/SpecialShortpages.php
+++ b/includes/specials/SpecialShortpages.php
@@ -38,12 +38,21 @@
        }
 
        public function getQueryInfo() {
-               $tables = [ 'page' ];
+               $tables = [ 'page', 'watchlist' ];
                $conds = [
                        'page_namespace' => MWNamespace::getContentNamespaces(),
                        'page_is_redirect' => 0
                ];
-               $joinConds = [];
+               $joinConds = [
+                       'watchlist' => [
+                               'LEFT JOIN',
+                               [
+                                       'wl_user=' . $this->getUser()->getId(),
+                                       'wl_title=page_title',
+                                       'wl_namespace=page_namespace'
+                               ]
+                       ]
+               ];
                $options = [ 'USE INDEX' => [ 'page' => 
'page_redirect_namespace_len' ] ];
 
                // Allow extensions to modify the query
@@ -54,7 +63,8 @@
                        'fields' => [
                                'namespace' => 'page_namespace',
                                'title' => 'page_title',
-                               'value' => 'page_len'
+                               'value' => 'page_len',
+                               'watched' => 'wl_user'
                        ],
                        'conds' => $conds,
                        'join_conds' => $joinConds,
@@ -113,10 +123,18 @@
                $hlinkInParentheses = $this->msg( 'parentheses' )->rawParams( 
$hlink )->escaped();
 
                if ( $this->isCached() ) {
-                       $plink = Linker::link( $title );
+                       $plink = Linker::link(
+                               $title,
+                               null,
+                               empty( $result->watched ) ? [] : [ 'class' => 
'mw-watched-item' ]
+                       );
                        $exists = $title->exists();
                } else {
-                       $plink = Linker::linkKnown( $title );
+                       $plink = Linker::linkKnown(
+                               $title,
+                               null,
+                               empty( $result->watched ) ? [] : [ 'class' => 
'mw-watched-item' ]
+                       );
                        $exists = true;
                }
 
diff --git a/includes/specials/SpecialUncategorizedpages.php 
b/includes/specials/SpecialUncategorizedpages.php
index 30b33cc..59537b8 100644
--- a/includes/specials/SpecialUncategorizedpages.php
+++ b/includes/specials/SpecialUncategorizedpages.php
@@ -48,11 +48,12 @@
 
        function getQueryInfo() {
                return [
-                       'tables' => [ 'page', 'categorylinks' ],
+                       'tables' => [ 'page', 'categorylinks', 'watchlist' ],
                        'fields' => [
                                'namespace' => 'page_namespace',
                                'title' => 'page_title',
-                               'value' => 'page_title'
+                               'value' => 'page_title',
+                               'watched' => 'wl_user'
                        ],
                        // default for page_namespace is all content namespaces 
(if requestedNamespace is false)
                        // otherwise, page_namespace is requestedNamespace
@@ -64,7 +65,15 @@
                                'page_is_redirect' => 0
                        ],
                        'join_conds' => [
-                               'categorylinks' => [ 'LEFT JOIN', 'cl_from = 
page_id' ]
+                               'categorylinks' => [ 'LEFT JOIN', 'cl_from = 
page_id' ],
+                               'watchlist' => [
+                                       'LEFT JOIN',
+                                       [
+                                               'wl_user=' . 
$this->getUser()->getId(),
+                                               'wl_title=page_title',
+                                               'wl_namespace=page_namespace'
+                                       ]
+                               ]
                        ]
                ];
        }
diff --git a/includes/specials/SpecialWithoutinterwiki.php 
b/includes/specials/SpecialWithoutinterwiki.php
index e2052b9..0b24425 100644
--- a/includes/specials/SpecialWithoutinterwiki.php
+++ b/includes/specials/SpecialWithoutinterwiki.php
@@ -83,18 +83,29 @@
 
        function getQueryInfo() {
                $query = [
-                       'tables' => [ 'page', 'langlinks' ],
+                       'tables' => [ 'page', 'langlinks', 'watchlist' ],
                        'fields' => [
                                'namespace' => 'page_namespace',
                                'title' => 'page_title',
-                               'value' => 'page_title'
+                               'value' => 'page_title',
+                               'watched' => 'wl_user'
                        ],
                        'conds' => [
                                'll_title IS NULL',
                                'page_namespace' => 
MWNamespace::getContentNamespaces(),
                                'page_is_redirect' => 0
                        ],
-                       'join_conds' => [ 'langlinks' => [ 'LEFT JOIN', 
'll_from = page_id' ] ]
+                       'join_conds' => [
+                               'langlinks' => [ 'LEFT JOIN', 'll_from = 
page_id' ],
+                               'watchlist' => [
+                                       'LEFT JOIN',
+                                       [
+                                               'wl_user=' . 
$this->getUser()->getId(),
+                                               'wl_title=page_title',
+                                               'wl_namespace=page_namespace'
+                                       ]
+                               ]
+                       ]
                ];
                if ( $this->prefix ) {
                        $dbr = wfGetDB( DB_SLAVE );
diff --git a/resources/src/mediawiki.special/mediawiki.special.css 
b/resources/src/mediawiki.special/mediawiki.special.css
index 15f4e4d..a986cc2 100644
--- a/resources/src/mediawiki.special/mediawiki.special.css
+++ b/resources/src/mediawiki.special/mediawiki.special.css
@@ -121,3 +121,8 @@
        font-size: 90%;
        text-align: right;
 }
+
+/* Special:[Deadendpages, Shortpages, LonelyPagesPage, Uncategorizedpages, 
Withoutinterwiki] */
+.mw-watched-item {
+       font-weight: bold;
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/279956
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1186301cbcc9235cf344a571c0af1698865b5a2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ferveo <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to