Allow minor edits to be filtered out of Special:Contributions
authorThis, that and the other <at.light@live.com.au>
Wed, 7 Oct 2015 11:04:09 +0000 (22:04 +1100)
committerThis, that and the other <at.light@live.com.au>
Wed, 1 Jun 2016 11:00:07 +0000 (21:00 +1000)
Just another checkbox and option flag...

Bug: T16086
Change-Id: Iacc66213798fa527adc3346fe1763ab0e04d2afe

includes/api/ApiFeedContributions.php
includes/api/i18n/en.json
includes/api/i18n/qqq.json
includes/specials/SpecialContributions.php
includes/specials/pagers/ContribsPager.php
languages/i18n/en.json
languages/i18n/qqq.json

index e28b068..c7dc303 100644 (file)
@@ -79,6 +79,7 @@ class ApiFeedContributions extends ApiBase {
                        'deletedOnly' => $params['deletedonly'],
                        'topOnly' => $params['toponly'],
                        'newOnly' => $params['newonly'],
+                       'hideMinor' => $params['hideminor'],
                        'showSizeDiff' => $params['showsizediff'],
                ] );
 
@@ -208,6 +209,7 @@ class ApiFeedContributions extends ApiBase {
                        'deletedonly' => false,
                        'toponly' => false,
                        'newonly' => false,
+                       'hideminor' => false,
                        'showsizediff' => [
                                ApiBase::PARAM_DFLT => false,
                        ],
index 4e9309e..dab7437 100644 (file)
        "apihelp-feedcontributions-param-deletedonly": "Show only deleted contributions.",
        "apihelp-feedcontributions-param-toponly": "Only show edits that are latest revisions.",
        "apihelp-feedcontributions-param-newonly": "Only show edits that are page creations.",
+       "apihelp-feedcontributions-param-hideminor": "Hide minor edits.",
        "apihelp-feedcontributions-param-showsizediff": "Show the size difference between revisions.",
        "apihelp-feedcontributions-example-simple": "Return contributions for user <kbd>Example</kbd>.",
 
index 6137457..e7fe5ce 100644 (file)
        "apihelp-feedcontributions-param-deletedonly": "{{doc-apihelp-param|feedcontributions|deletedonly}}",
        "apihelp-feedcontributions-param-toponly": "{{doc-apihelp-param|feedcontributions|toponly}}",
        "apihelp-feedcontributions-param-newonly": "{{doc-apihelp-param|feedcontributions|newonly}}",
+       "apihelp-feedcontributions-param-hideminor": "{{doc-apihelp-param|feedcontributions|hideminor}}",
        "apihelp-feedcontributions-param-showsizediff": "{{doc-apihelp-param|feedcontributions|showsizediff}}",
        "apihelp-feedcontributions-example-simple": "{{doc-apihelp-example|feedcontributions}}",
        "apihelp-feedrecentchanges-description": "{{doc-apihelp-description|feedrecentchanges}}",
index 431b556..ac7e62e 100644 (file)
@@ -72,6 +72,7 @@ class SpecialContributions extends IncludableSpecialPage {
                $this->opts['target'] = $target;
                $this->opts['topOnly'] = $request->getBool( 'topOnly' );
                $this->opts['newOnly'] = $request->getBool( 'newOnly' );
+               $this->opts['hideMinor'] = $request->getBool( 'hideMinor' );
 
                $nt = Title::makeTitleSafe( NS_USER, $target );
                if ( !$nt ) {
@@ -142,6 +143,9 @@ class SpecialContributions extends IncludableSpecialPage {
                if ( $this->opts['newOnly'] ) {
                        $feedParams['newonly'] = true;
                }
+               if ( $this->opts['hideMinor'] ) {
+                       $feedParams['hideminor'] = true;
+               }
                if ( $this->opts['deletedOnly'] ) {
                        $feedParams['deletedonly'] = true;
                }
@@ -188,6 +192,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                'deletedOnly' => $this->opts['deletedOnly'],
                                'topOnly' => $this->opts['topOnly'],
                                'newOnly' => $this->opts['newOnly'],
+                               'hideMinor' => $this->opts['hideMinor'],
                                'nsInvert' => $this->opts['nsInvert'],
                                'associated' => $this->opts['associated'],
                        ] );
@@ -441,6 +446,10 @@ class SpecialContributions extends IncludableSpecialPage {
                        $this->opts['newOnly'] = false;
                }
 
+               if ( !isset( $this->opts['hideMinor'] ) ) {
+                       $this->opts['hideMinor'] = false;
+               }
+
                $form = Html::openElement(
                        'form',
                        [
@@ -461,6 +470,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        'month',
                        'topOnly',
                        'newOnly',
+                       'hideMinor',
                        'associated',
                        'tagfilter'
                ];
@@ -609,6 +619,17 @@ class SpecialContributions extends IncludableSpecialPage {
                                [ 'class' => 'mw-input' ]
                        )
                );
+               $filters[] = Html::rawElement(
+                       'span',
+                       [ 'class' => 'mw-input-with-label' ],
+                       Xml::checkLabel(
+                               $this->msg( 'sp-contributions-hideminor' )->text(),
+                               'hideMinor',
+                               'mw-hide-minor-edits',
+                               $this->opts['hideMinor'],
+                               [ 'class' => 'mw-input' ]
+                       )
+               );
 
                Hooks::run(
                        'SpecialContributions::getForm::filters',
index d90c37b..193a444 100644 (file)
@@ -64,6 +64,7 @@ class ContribsPager extends ReverseChronologicalPager {
                $this->deletedOnly = !empty( $options['deletedOnly'] );
                $this->topOnly = !empty( $options['topOnly'] );
                $this->newOnly = !empty( $options['newOnly'] );
+               $this->hideMinor = !empty( $options['hideMinor'] );
 
                $year = isset( $options['year'] ) ? $options['year'] : false;
                $month = isset( $options['month'] ) ? $options['month'] : false;
@@ -246,6 +247,10 @@ class ContribsPager extends ReverseChronologicalPager {
                        $condition[] = 'rev_parent_id = 0';
                }
 
+               if ( $this->hideMinor ) {
+                       $condition[] = 'rev_minor_edit = 0';
+               }
+
                return [ $tables, $index, $condition, $join_conds ];
        }
 
index f135f40..9ca08ec 100644 (file)
        "sp-contributions-username": "IP address or username:",
        "sp-contributions-toponly": "Only show edits that are latest revisions",
        "sp-contributions-newonly": "Only show edits that are page creations",
+       "sp-contributions-hideminor": "Hide minor edits",
        "sp-contributions-submit": "Search",
        "sp-contributions-explain": "",
        "sp-contributions-footer": "-",
index e2a4f8b..07fd848 100644 (file)
        "sp-contributions-username": "This message appears whenever someone requests [[Special:Contributions]].\n{{Identical|IP address or username}}",
        "sp-contributions-toponly": "A checkbox at [[Special:Mycontributions|Special:Contributions]]",
        "sp-contributions-newonly": "Used as checkbox label at [[Special:Mycontributions|Special:Contributions]].\n\n\"page creation\" means the \"first revision\" of a page.\n\nPreceded by {{msg-mw|Sp-contributions-toponly}}.",
+       "sp-contributions-hideminor": "Used as checkbox label at [[Special:Mycontributions|Special:Contributions]].\n\nSee also:\n* {{msg-mw|Tog-hideminor}}",
        "sp-contributions-submit": "{{Identical|Search}}",
        "sp-contributions-explain": "{{optional}}",
        "sp-contributions-footer": "{{ignored}}This is the footer for users that are not anonymous or newbie on [[Special:Contributions]].",