RC Filters: Last revision filter group
authorStephane Bisson <sbisson@wikimedia.org>
Mon, 1 May 2017 17:21:56 +0000 (13:21 -0400)
committerStephane Bisson <sbisson@wikimedia.org>
Mon, 1 May 2017 17:21:56 +0000 (13:21 -0400)
New filter group to show changes related to the last
revision of a page or show changes on previous revisions.

Bug: T163561
Change-Id: Ifc376a34bbe564714285894f93ffb80aa82f5fdf

includes/specialpage/ChangesListSpecialPage.php
languages/i18n/en.json
languages/i18n/qqq.json

index 3aafc94..bc241e0 100644 (file)
@@ -254,6 +254,43 @@ abstract class ChangesListSpecialPage extends SpecialPage {
 
                        // reviewStatus (conditional)
 
+                       [
+                               'name' => 'lastRevision',
+                               'title' => 'rcfilters-filtergroup-lastRevision',
+                               'class' => ChangesListBooleanFilterGroup::class,
+                               'priority' => -7,
+                               'filters' => [
+                                       [
+                                               'name' => 'hidelastrevision',
+                                               'label' => 'rcfilters-filter-lastrevision-label',
+                                               'description' => 'rcfilters-filter-lastrevision-description',
+                                               'default' => false,
+                                               'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds,
+                                                       &$query_options, &$join_conds ) {
+                                                       $conds[] = 'rc_this_oldid <> page_latest';
+                                               },
+                                               'cssClassSuffix' => 'last',
+                                               'isRowApplicableCallable' => function ( $ctx, $rc ) {
+                                                       return $rc->getAttribute( 'rc_this_oldid' ) === $rc->getAttribute( 'page_latest' );
+                                               }
+                                       ],
+                                       [
+                                               'name' => 'hidepreviousrevisions',
+                                               'label' => 'rcfilters-filter-previousrevision-label',
+                                               'description' => 'rcfilters-filter-previousrevision-description',
+                                               'default' => false,
+                                               'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds,
+                                                       &$query_options, &$join_conds ) {
+                                                       $conds[] = 'rc_this_oldid = page_latest';
+                                               },
+                                               'cssClassSuffix' => 'previous',
+                                               'isRowApplicableCallable' => function ( $ctx, $rc ) {
+                                                       return $rc->getAttribute( 'rc_this_oldid' ) !== $rc->getAttribute( 'page_latest' );
+                                               }
+                                       ]
+                               ]
+                       ],
+
                        [
                                'name' => 'significance',
                                'title' => 'rcfilters-filtergroup-significance',
index 5913bcb..3f5b881 100644 (file)
        "rcfilters-hideminor-conflicts-typeofchange-global": "The \"Minor edits\" filter conflicts with one or more Type of Change filters, because certain types of change cannot be designated as \"minor.\" The conflicting filters are marked in the Active Filters area, above.",
        "rcfilters-hideminor-conflicts-typeofchange": "Certain types of change cannot be designated as \"minor,\" so this filter conflicts with the following Type of Change filters: $1",
        "rcfilters-typeofchange-conflicts-hideminor": "This Type of Change filter conflicts with the \"Minor Edits\" filter. Certain types of change cannot be designated as \"minor.\"",
+       "rcfilters-filtergroup-lastRevision": "Last revision",
+       "rcfilters-filter-lastrevision-label": "Last revision",
+       "rcfilters-filter-lastrevision-description": "The most recent change to a page.",
+       "rcfilters-filter-previousrevision-label": "Earlier revisions",
+       "rcfilters-filter-previousrevision-description": "All changes that are not the most recent change to a page.",
        "rcnotefrom": "Below {{PLURAL:$5|is the change|are the changes}} since <strong>$3, $4</strong> (up to <strong>$1</strong> shown).",
        "rclistfromreset": "Reset date selection",
        "rclistfrom": "Show new changes starting from $2, $3",
index 2039b1e..4339f3d 100644 (file)
        "rcfilters-hideminor-conflicts-typeofchange-global": "The \"Minor edits\" filter is conflicting with one or more Type of Change filters, because certain types of change cannot be designated as \"minor.\" The conflicting filters are marked in the Active Filters area, above.\n\n\"Type of Change\" is {{msg-mw|Rcfilters-filtergroup-changetype}}.",
        "rcfilters-hideminor-conflicts-typeofchange": "Tooltip shown when hovering over the Minor edits tag, when a Type of Change filter is also selected.\n\n\"Minor edits\" is {{msg-mw|rcfilters-filter-minor-label}}.\n\n\"Type of change\" is {{msg-mw|rcfilters-filtergroup-changetype}}.\n\nThis indicates that no results will be shown.  Parameters:\n* $1 - Comma-separated string of selected Type of Change filters, e.g. \"Category, Logged Actions\"\n* $2 - Count of selected User Experience Level filters, for PLURAL",
        "rcfilters-typeofchange-conflicts-hideminor": "Tooltip shown when hovering over a Type of change filter tag, when the Minor edits filter is also selected.\n\n\"Minor edits\" is {{msg-mw|rcfilters-filter-minor-label}}.\n\n\"Type of change\" is {{msg-mw|rcfilters-filtergroup-changetype}}.\n\nThis indicates that no results will be shown.",
+       "rcfilters-filtergroup-lastRevision": "Title for the filter group for last revision",
+       "rcfilters-filter-lastrevision-label": "Title for the filter for showing changes on last revision of a page.",
+       "rcfilters-filter-lastrevision-description": "Description for the filter for showing changes on last revision of a page.",
+       "rcfilters-filter-previousrevision-label": "Title for the filter for showing changes on previous revisions of a page.",
+       "rcfilters-filter-previousrevision-description": "Description for the filter for showing changes on previous revisions of a page.",
        "rcnotefrom": "This message is displayed at [[Special:RecentChanges]] when viewing recentchanges from some specific time.\n\nThe corresponding message is {{msg-mw|Rclistfrom}}.\n\nParameters:\n* $1 - the maximum number of changes that are displayed\n* $2 - (Optional) a date and time\n* $3 - a date\n* $4 - a time\n* $5 - Number of changes are displayed, for use with PLURAL",
        "rclistfromreset": "Used on [[Special:RecentChanges]] to reset a selection of a certain date range.",
        "rclistfrom": "Used on [[Special:RecentChanges]]. Parameters:\n* $1 - (Currently not use) date and time. The date and the time adds to the rclistfrom description.\n* $2 - time. The time adds to the rclistfrom link description (with split of date and time).\n* $3 - date. The date adds to the rclistfrom link description (with split of date and time).\n\nThe corresponding message is {{msg-mw|Rcnotefrom}}.",