Gerrit Patch Uploader has uploaded a new change for review.

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

Change subject: Add 'newonly' option to Special:Contributions and related i18n 
message
......................................................................

Add 'newonly' option to Special:Contributions and related i18n message

Bug: 42026
Change-Id: I07d597ef378d897690097804bf7c774fdadb654c
---
M includes/specials/SpecialContributions.php
M languages/messages/MessagesEn.php
M languages/messages/MessagesQqq.php
M maintenance/language/messages.inc
4 files changed, 32 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/89/115189/1

diff --git a/includes/specials/SpecialContributions.php 
b/includes/specials/SpecialContributions.php
index c594807..f601199 100644
--- a/includes/specials/SpecialContributions.php
+++ b/includes/specials/SpecialContributions.php
@@ -74,6 +74,7 @@
                $this->opts['limit'] = $request->getInt( 'limit', 
$user->getOption( 'rclimit' ) );
                $this->opts['target'] = $target;
                $this->opts['topOnly'] = $request->getBool( 'topOnly' );
+               $this->opts['newOnly'] = $request->getBool( 'newOnly' );
 
                $nt = Title::makeTitleSafe( NS_USER, $target );
                if ( !$nt ) {
@@ -140,6 +141,9 @@
                if ( $this->opts['topOnly'] ) {
                        $feedParams['toponly'] = true;
                }
+               if ( $this->opts['newOnly'] ) {
+                       $feedParams['newonly'] = true;
+               }
                if ( $this->opts['deletedOnly'] ) {
                        $feedParams['deletedonly'] = true;
                }
@@ -185,6 +189,7 @@
                                'month' => $this->opts['month'],
                                'deletedOnly' => $this->opts['deletedOnly'],
                                'topOnly' => $this->opts['topOnly'],
+                               'newOnly' => $this->opts['newOnly'],
                                'nsInvert' => $this->opts['nsInvert'],
                                'associated' => $this->opts['associated'],
                        ) );
@@ -404,6 +409,10 @@
                        $this->opts['topOnly'] = false;
                }
 
+               if ( !isset( $this->opts['newOnly'] ) ) {
+                       $this->opts['newOnly'] = false;
+               }
+
                $form = Html::openElement(
                        'form',
                        array(
@@ -423,6 +432,7 @@
                        'year',
                        'month',
                        'topOnly',
+                       'newOnly',
                        'associated'
                );
 
@@ -555,10 +565,21 @@
                                array( 'class' => 'mw-input' )
                        )
                );
+               $checkLabelNewOnly = Html::rawElement(
+                       'span',
+                       array( 'style' => 'white-space: nowrap' ),
+                       Xml::checkLabel(
+                               $this->msg( 'sp-contributions-newonly' 
)->text(),
+                               'newOnly',
+                               'mw-show-new-only',
+                               $this->opts['newOnly'],
+                               array( 'class' => 'mw-input' )
+                       )
+               );
                $extraOptions = Html::rawElement(
                        'td',
-                       array( 'colspan' => 2 ),
-                       $deletedOnlyCheck . $checkLabelTopOnly
+                       array( 'colspan' => 3 ),
+                       $deletedOnlyCheck . $checkLabelTopOnly . 
$checkLabelNewOnly
                );
 
                $dateSelectionAndSubmit = Xml::tags( 'td', array( 'colspan' => 
2 ),
@@ -640,8 +661,9 @@
                $this->nsInvert = isset( $options['nsInvert'] ) ? 
$options['nsInvert'] : false;
                $this->associated = isset( $options['associated'] ) ? 
$options['associated'] : false;
 
-               $this->deletedOnly = !empty( $options['deletedOnly'] );
                $this->topOnly = !empty( $options['topOnly'] );
+               $this->newOnly = !empty( $options['newOnly'] );
+               $this->deletedOnly = !empty( $options['deletedOnly'] );
 
                $year = isset( $options['year'] ) ? $options['year'] : false;
                $month = isset( $options['month'] ) ? $options['month'] : false;
@@ -821,6 +843,10 @@
                        $condition[] = 'rev_id = page_latest';
                }
 
+               if ( $this->newOnly ) {
+                       $condition[] = 'rev_parent_id = 0';
+               }
+
                return array( $tables, $index, $condition, $join_conds );
        }
 
diff --git a/languages/messages/MessagesEn.php 
b/languages/messages/MessagesEn.php
index 3fffec2..9716619 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -3266,6 +3266,7 @@
 'sp-contributions-search'              => 'Search for contributions',
 '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-submit'              => 'Search',
 'sp-contributions-explain'             => '', # only translate this message to 
other languages if you have to change it
 'sp-contributions-footer'              => '-', # do not translate or duplicate 
this message to other languages
diff --git a/languages/messages/MessagesQqq.php 
b/languages/messages/MessagesQqq.php
index f4dbfdd..13dd1e2 100644
--- a/languages/messages/MessagesQqq.php
+++ b/languages/messages/MessagesQqq.php
@@ -6265,6 +6265,7 @@
 'sp-contributions-username' => 'This message appears whenever someone requests 
[[Special:Contributions]].
 {{Identical|IP address or username}}',
 'sp-contributions-toponly' => '"top revision" means the "latest revision"',
+'sp-contributions-newonly' => '"page creation" means the "first revision" of a 
page',
 'sp-contributions-submit' => '{{Identical|Search}}',
 'sp-contributions-explain' => '{{optional}}',
 
diff --git a/maintenance/language/messages.inc 
b/maintenance/language/messages.inc
index eab6cf6..7a9fc92 100644
--- a/maintenance/language/messages.inc
+++ b/maintenance/language/messages.inc
@@ -2241,6 +2241,7 @@
                'sp-contributions-search',
                'sp-contributions-username',
                'sp-contributions-toponly',
+               'sp-contributions-newonly',
                'sp-contributions-submit',
                'sp-contributions-explain',
                'sp-contributions-footer',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07d597ef378d897690097804bf7c774fdadb654c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to