Sbisson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351193 )

Change subject: RC Filters: watchlist
......................................................................

RC Filters: watchlist

Introducing filtering on watchlist status
  watchlist=watched|watchednew|notwatched

'watchednew' is a subset of 'watched

Bug: T163964
Change-Id: I04df40c8399e15a03a400b4a24afedf1df242a93
---
M includes/specialpage/ChangesListSpecialPage.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 73 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/93/351193/1

diff --git a/includes/specialpage/ChangesListSpecialPage.php 
b/includes/specialpage/ChangesListSpecialPage.php
index 3aafc94..26fe307 100644
--- a/includes/specialpage/ChangesListSpecialPage.php
+++ b/includes/specialpage/ChangesListSpecialPage.php
@@ -355,6 +355,60 @@
                                        ],
                                ],
                        ],
+
+                       [
+                               'name' => 'watchlist',
+                               'title' => 'rcfilters-filtergroup-watchlist',
+                               'class' => 
ChangesListStringOptionsFilterGroup::class,
+                               'isFullCoverage' => true,
+                               'filters' => [
+                                       [
+                                               'name' => 'watched',
+                                               'label' => 
'rcfilters-filter-watchlist-watched-label',
+                                               'description' => 
'rcfilters-filter-watchlist-watched-description',
+                                               'cssClassSuffix' => 'watched',
+                                               'isRowApplicableCallable' => 
function ( $ctx, $rc ) {
+                                                       return 
$rc->getAttribute( 'wl_user' );
+                                               }
+                                       ],
+                                       [
+                                               'name' => 'watchednew',
+                                               'label' => 
'rcfilters-filter-watchlist-watchednew-label',
+                                               'description' => 
'rcfilters-filter-watchlist-watchednew-description',
+                                               'cssClassSuffix' => 
'watchednew',
+                                               'isRowApplicableCallable' => 
function ( $ctx, $rc ) {
+                                                       return 
$rc->getAttribute( 'wl_user' ) &&
+                                                               
$rc->getAttribute( 'rc_timestamp' ) > $rc->getAttribute( 
'wl_notificationtimestamp' );
+                                               },
+                                       ],
+                                       [
+                                               'name' => 'notwatched',
+                                               'label' => 
'rcfilters-filter-watchlist-notwatched-label',
+                                               'description' => 
'rcfilters-filter-watchlist-notwatched-description',
+                                               'cssClassSuffix' => 
'notwatched',
+                                               'isRowApplicableCallable' => 
function ( $ctx, $rc ) {
+                                                       return 
$rc->getAttribute( 'wl_user' ) === null;
+                                               },
+                                       ]
+                               ],
+                               'default' => 
ChangesListStringOptionsFilterGroup::NONE,
+                               'queryCallable' => function ( 
$specialPageClassName, $context, $dbr,
+                                       &$tables, &$fields, &$conds, 
&$query_options, &$join_conds, $selectedValues ) {
+                                       if ( in_array( 'watched', 
$selectedValues ) ) {
+                                               $conds[] = 'wl_user IS NOT 
NULL';
+                                       }
+
+                                       if ( in_array( 'watchednew', 
$selectedValues ) ) {
+                                               $conds[] = 'wl_user IS NOT 
NULL';
+                                               $conds[] = 'rc_timestamp >= 
wl_notificationtimestamp';
+
+                                       }
+
+                                       if ( in_array( 'notwatched', 
$selectedValues ) ) {
+                                               $conds[] = 'wl_user IS NULL';
+                                       }
+                               },
+                       ],
                ];
 
                $this->reviewStatusFilterGroupDefinition = [
@@ -642,6 +696,11 @@
                        'rcfilters-hideminor-conflicts-typeofchange',
                        'rcfilters-typeofchange-conflicts-hideminor'
                );
+
+               $watchlistGroup = $this->getFilterGroup( 'watchlist' );
+               $watchlistGroup->getFilter( 'watched' )->setAsSupersetOf(
+                       $watchlistGroup->getFilter( 'watchednew' )
+               );
        }
 
        /**
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 5913bcb..e9b9f04 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -1415,6 +1415,13 @@
        "rcfilters-filter-minor-description": "Edits the author labeled as 
minor.",
        "rcfilters-filter-major-label": "Non-minor edits",
        "rcfilters-filter-major-description": "Edits not labeled as minor.",
+       "rcfilters-filtergroup-watchlist": "Watchlisted pages",
+       "rcfilters-filter-watchlist-watched-label": "On Watchlist",
+       "rcfilters-filter-watchlist-watched-description": "Changes to pages on 
your Watchlist.",
+       "rcfilters-filter-watchlist-watchednew-label": "New Watchlist changes",
+       "rcfilters-filter-watchlist-watchednew-description": "Changes to 
Watchlisted pages you haven't visited since the changes occurred.",
+       "rcfilters-filter-watchlist-notwatched-label": "Not on Watchlist",
+       "rcfilters-filter-watchlist-notwatched-description": "Everything except 
changes to your Watchlisted pages.",
        "rcfilters-filtergroup-changetype": "Type of change",
        "rcfilters-filter-pageedits-label": "Page edits",
        "rcfilters-filter-pageedits-description": "Edits to wiki content, 
discussions, category descriptions....",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 2039b1e..c795be4 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -1603,6 +1603,13 @@
        "rcfilters-filter-minor-description": "Description for the filter for 
showing edits marked as minor.",
        "rcfilters-filter-major-label": "Label for the filter for showing edits 
not marked as minor.",
        "rcfilters-filter-major-description": " Description for the filter for 
showing edits not marked as minor.",
+       "rcfilters-filtergroup-watchlist": "Title for the watchlist filter 
group",
+       "rcfilters-filter-watchlist-watched-label": "Label for the filter for 
showing changes to pages on your watchlist.",
+       "rcfilters-filter-watchlist-watched-description": "Description for the 
filter for showing changes to pages on your watchlist.",
+       "rcfilters-filter-watchlist-watchednew-label": "Label for the filter 
for showing new changes to pages on your watchlist.",
+       "rcfilters-filter-watchlist-watchednew-description": "Description for 
the filter for showing new changes to pages on your watchlist.",
+       "rcfilters-filter-watchlist-notwatched-label": "Label for the filter 
for showing changes to pages not on your watchlist.",
+       "rcfilters-filter-watchlist-notwatched-description": "Description for 
the filter for showing changes to pages not on your watchlist.",
        "rcfilters-filtergroup-changetype": "Title for the filter group for 
edit type.",
        "rcfilters-filter-pageedits-label": "Label for the filter for showing 
edits to existing pages.",
        "rcfilters-filter-pageedits-description": "Description for the filter 
for showing edits to existing pages.",

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

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

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

Reply via email to