jenkins-bot has submitted this change and it was merged. Change subject: Add option to show only creations in Special:Contribs, API ......................................................................
Add option to show only creations in Special:Contribs, API * Add newOnly option to Special:Contributions * Add to i18n files * Add ucshow={new,!new,top,!top} to list=usercontribs * Deprecated 'uctoponly' in favor of ucshow=top per Anomie. * Add param 'newonly' to API action=feedcontributions * Implementation: rev_parent_id=0 Bug: 42026 Change-Id: I07d597ef378d897690097804bf7c774fdadb654c --- M RELEASE-NOTES-1.23 M includes/api/ApiFeedContributions.php M includes/api/ApiQueryUserContributions.php M includes/specials/SpecialContributions.php M languages/messages/MessagesEn.php M languages/messages/MessagesQqq.php M maintenance/language/messages.inc 7 files changed, 56 insertions(+), 6 deletions(-) Approvals: Anomie: Looks good to me, approved jenkins-bot: Verified diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 4f29097..5ac5647 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -109,6 +109,8 @@ $wgPasswordExpirationDays configuration setting. * Add new hook SendWatchlistEmailNotification, this will be used to determine whether to send a watchlist email notification. +* (bug 42026) Special:Contributions now includes an option to filter page + creations, similar to the topOnly option. === Bug fixes in 1.23 === * (bug 41759) The "updated since last visit" markers (on history pages, recent @@ -193,6 +195,9 @@ * Added llprop=langname and llprop=autonym for action=query&prop=langlinks. * prop=redirects is added, to return redirects to the pages in the query. * list=allredirects is added, to list all redirects pointing to a namespace. +* (bug 42026) Added ucshow={new,!new,top,!top} to list=usercontribs. + Also added newonly to action=feedcontributions. +* (bug 42026) Deprecated uctoponly in favor of ucshow=top. === Languages updated in 1.23 === diff --git a/includes/api/ApiFeedContributions.php b/includes/api/ApiFeedContributions.php index f90ba98..2cdc875 100644 --- a/includes/api/ApiFeedContributions.php +++ b/includes/api/ApiFeedContributions.php @@ -78,6 +78,7 @@ 'tagFilter' => $params['tagfilter'], 'deletedOnly' => $params['deletedonly'], 'topOnly' => $params['toponly'], + 'newOnly' => $params['newonly'], 'showSizeDiff' => $params['showsizediff'], ) ); @@ -186,6 +187,7 @@ ), 'deletedonly' => false, 'toponly' => false, + 'newonly' => false, 'showsizediff' => false, ); } @@ -200,6 +202,7 @@ 'tagfilter' => 'Filter contributions that have these tags', 'deletedonly' => 'Show only deleted contributions', 'toponly' => 'Only show edits that are latest revisions', + 'newonly' => 'Only show edits that are page creations', 'showsizediff' => 'Show the size difference between revisions. Disabled in Miser Mode', ); } diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index b492d9a..9ad77d4 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -207,10 +207,16 @@ $this->addWhereFld( 'page_namespace', $this->params['namespace'] ); $show = $this->params['show']; + if ( $this->params['toponly'] ) { // deprecated/old param + $show[] = 'top'; + } if ( !is_null( $show ) ) { $show = array_flip( $show ); + if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) ) || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) ) + || ( isset( $show['top'] ) && isset( $show['!top'] ) ) + || ( isset( $show['new'] ) && isset( $show['!new'] ) ) ) { $this->dieUsageMsg( 'show' ); } @@ -219,6 +225,10 @@ $this->addWhereIf( 'rev_minor_edit != 0', isset( $show['minor'] ) ); $this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) ); $this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) ); + $this->addWhereIf( 'rev_id != page_latest', isset( $show['!top'] ) ); + $this->addWhereIf( 'rev_id = page_latest', isset( $show['top'] ) ); + $this->addWhereIf( 'rev_parent_id != 0', isset( $show['!new'] ) ); + $this->addWhereIf( 'rev_parent_id = 0', isset( $show['new'] ) ); } $this->addOption( 'LIMIT', $this->params['limit'] + 1 ); $index = array( 'revision' => 'usertext_timestamp' ); @@ -292,10 +302,6 @@ array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) ); $this->addWhereFld( 'ct_tag', $this->params['tag'] ); - } - - if ( $this->params['toponly'] ) { - $this->addWhere( 'rev_id = page_latest' ); } $this->addOption( 'USE INDEX', $index ); @@ -477,10 +483,17 @@ '!minor', 'patrolled', '!patrolled', + 'top', + '!top', + 'new', + '!new', ) ), 'tag' => null, - 'toponly' => false, + 'toponly' => array( + ApiBase::PARAM_DFLT => false, + ApiBase::PARAM_DEPRECATED => true, + ), ); } diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index c594807..fdb781b 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 + $deletedOnlyCheck . $checkLabelTopOnly . $checkLabelNewOnly ); $dateSelectionAndSubmit = Xml::tags( 'td', array( 'colspan' => 2 ), @@ -642,6 +663,7 @@ $this->deletedOnly = !empty( $options['deletedOnly'] ); $this->topOnly = !empty( $options['topOnly'] ); + $this->newOnly = !empty( $options['newOnly'] ); $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 345bcd9..5a4fea5 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -6266,6 +6266,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: merged Gerrit-Change-Id: I07d597ef378d897690097804bf7c774fdadb654c Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Alex Monk <kren...@gmail.com> Gerrit-Reviewer: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com> Gerrit-Reviewer: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com> Gerrit-Reviewer: MZMcBride <w...@mzmcbride.com> Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com> Gerrit-Reviewer: PiRSquared17 <pirsquare...@gmail.com> Gerrit-Reviewer: Scott Martin <sc...@urbigenous.net> Gerrit-Reviewer: Springle <sprin...@wikimedia.org> Gerrit-Reviewer: Technical 13 <technical...@yahoo.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits