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
This commit is contained in:
parent
f25ab4fcb2
commit
2dfbd7761a
7 changed files with 56 additions and 6 deletions
|
|
@ -109,6 +109,8 @@ production.
|
|||
$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 @@ production.
|
|||
* 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 ===
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ class ApiFeedContributions extends ApiBase {
|
|||
'tagFilter' => $params['tagfilter'],
|
||||
'deletedOnly' => $params['deletedonly'],
|
||||
'topOnly' => $params['toponly'],
|
||||
'newOnly' => $params['newonly'],
|
||||
'showSizeDiff' => $params['showsizediff'],
|
||||
) );
|
||||
|
||||
|
|
@ -186,6 +187,7 @@ class ApiFeedContributions extends ApiBase {
|
|||
),
|
||||
'deletedonly' => false,
|
||||
'toponly' => false,
|
||||
'newonly' => false,
|
||||
'showsizediff' => false,
|
||||
);
|
||||
}
|
||||
|
|
@ -200,6 +202,7 @@ class ApiFeedContributions extends ApiBase {
|
|||
'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',
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,10 +207,16 @@ class ApiQueryContributions extends ApiQueryBase {
|
|||
$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 @@ class ApiQueryContributions extends ApiQueryBase {
|
|||
$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' );
|
||||
|
|
@ -294,10 +304,6 @@ class ApiQueryContributions extends ApiQueryBase {
|
|||
$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 @@ class ApiQueryContributions extends ApiQueryBase {
|
|||
'!minor',
|
||||
'patrolled',
|
||||
'!patrolled',
|
||||
'top',
|
||||
'!top',
|
||||
'new',
|
||||
'!new',
|
||||
)
|
||||
),
|
||||
'tag' => null,
|
||||
'toponly' => false,
|
||||
'toponly' => array(
|
||||
ApiBase::PARAM_DFLT => false,
|
||||
ApiBase::PARAM_DEPRECATED => true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ class SpecialContributions extends IncludableSpecialPage {
|
|||
$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 @@ class SpecialContributions extends IncludableSpecialPage {
|
|||
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 @@ class SpecialContributions extends IncludableSpecialPage {
|
|||
'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 @@ class SpecialContributions extends IncludableSpecialPage {
|
|||
$this->opts['topOnly'] = false;
|
||||
}
|
||||
|
||||
if ( !isset( $this->opts['newOnly'] ) ) {
|
||||
$this->opts['newOnly'] = false;
|
||||
}
|
||||
|
||||
$form = Html::openElement(
|
||||
'form',
|
||||
array(
|
||||
|
|
@ -423,6 +432,7 @@ class SpecialContributions extends IncludableSpecialPage {
|
|||
'year',
|
||||
'month',
|
||||
'topOnly',
|
||||
'newOnly',
|
||||
'associated'
|
||||
);
|
||||
|
||||
|
|
@ -555,10 +565,21 @@ class SpecialContributions extends IncludableSpecialPage {
|
|||
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 @@ class ContribsPager extends ReverseChronologicalPager {
|
|||
|
||||
$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 @@ class ContribsPager extends ReverseChronologicalPager {
|
|||
$condition[] = 'rev_id = page_latest';
|
||||
}
|
||||
|
||||
if ( $this->newOnly ) {
|
||||
$condition[] = 'rev_parent_id = 0';
|
||||
}
|
||||
|
||||
return array( $tables, $index, $condition, $join_conds );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3266,6 +3266,7 @@ The latest block log entry is provided below for reference:',
|
|||
'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
|
||||
|
|
|
|||
|
|
@ -6266,6 +6266,7 @@ Anon version:
|
|||
'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}}',
|
||||
|
||||
|
|
|
|||
|
|
@ -2241,6 +2241,7 @@ $wgMessageStructure = array(
|
|||
'sp-contributions-search',
|
||||
'sp-contributions-username',
|
||||
'sp-contributions-toponly',
|
||||
'sp-contributions-newonly',
|
||||
'sp-contributions-submit',
|
||||
'sp-contributions-explain',
|
||||
'sp-contributions-footer',
|
||||
|
|
|
|||
Loading…
Reference in a new issue