[MediaWiki-commits] [Gerrit] Add show=unpatrolled to the recentchanges API - change (mediawiki/core)

2013-11-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Add show=unpatrolled to the recentchanges API
..


Add show=unpatrolled to the recentchanges API

Adding it only in the API because SpecialRecentChanges only shows
Hide patrolled edits option if rcpatrol is enabled.

show=!patrolled returns results that include changes that can't
be patrolled which technically correct (they aren't correct)
but probably not what you're looking for when looking for
unpatrolled changes.

Change-Id: I356a8625c7126b90aa7e7a23efe3bef7d448b502
---
M includes/api/ApiQueryRecentChanges.php
1 file changed, 15 insertions(+), 2 deletions(-)

Approvals:
  Anomie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiQueryRecentChanges.php 
b/includes/api/ApiQueryRecentChanges.php
index 7848853..50a3352 100644
--- a/includes/api/ApiQueryRecentChanges.php
+++ b/includes/api/ApiQueryRecentChanges.php
@@ -192,12 +192,14 @@
|| ( isset( $show['anon'] )  isset( 
$show['!anon'] ) )
|| ( isset( $show['redirect'] )  isset( 
$show['!redirect'] ) )
|| ( isset( $show['patrolled'] )  isset( 
$show['!patrolled'] ) )
+   || ( isset( $show['patrolled'] )  isset( 
$show['unpatrolled'] ) )
+   || ( isset( $show['!patrolled'] )  isset( 
$show['unpatrolled'] ) )
) {
$this-dieUsageMsg( 'show' );
}
 
// Check permissions
-   if ( isset( $show['patrolled'] ) || isset( 
$show['!patrolled'] ) ) {
+   if ( isset( $show['patrolled'] ) || isset( 
$show['!patrolled'] ) || isset( $show['unpatrolled'] ) ) {
if ( !$user-useRCPatrol()  
!$user-useNPPatrol() ) {
$this-dieUsage(
'You need the patrol right to 
request the patrolled flag',
@@ -216,6 +218,16 @@
$this-addWhereIf( 'rc_patrolled = 0', isset( 
$show['!patrolled'] ) );
$this-addWhereIf( 'rc_patrolled != 0', isset( 
$show['patrolled'] ) );
$this-addWhereIf( 'page_is_redirect = 1', isset( 
$show['redirect'] ) );
+
+   if ( isset( $show['unpatrolled'] ) ) {
+   // See ChangesList:isUnpatrolled
+   if ( $user-useRCPatrol() ) {
+   $this-addWhere( 'rc_patrolled = 0' );
+   } elseif ( $user-useNPPatrol() ) {
+   $this-addWhere( 'rc_patrolled = 0' );
+   $this-addWhereFld( 'rc_type', RC_NEW );
+   }
+   }
 
// Don't throw log entries out the window here
$this-addWhereIf(
@@ -639,7 +651,8 @@
'redirect',
'!redirect',
'patrolled',
-   '!patrolled'
+   '!patrolled',
+   'unpatrolled'
)
),
'limit' = array(

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I356a8625c7126b90aa7e7a23efe3bef7d448b502
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle krinklem...@gmail.com
Gerrit-Reviewer: Anomie bjor...@wikimedia.org
Gerrit-Reviewer: Krinkle krinklem...@gmail.com
Gerrit-Reviewer: Parent5446 tylerro...@gmail.com
Gerrit-Reviewer: jenkins-bot

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


[MediaWiki-commits] [Gerrit] Add show=unpatrolled to the recentchanges API - change (mediawiki/core)

2013-10-25 Thread Krinkle (Code Review)
Krinkle has uploaded a new change for review.

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


Change subject: Add show=unpatrolled to the recentchanges API
..

Add show=unpatrolled to the recentchanges API

Adding it only in the API because SpecialRecentChanges only shows
Hide patrolled edits option if rcpatrol is enabled.

show=!patrolled returns results that include changes that can't
be patrolled which technically correct (they aren't correct)
but probably not what you're looking for when looking for
unpatrolled changes.

Change-Id: I356a8625c7126b90aa7e7a23efe3bef7d448b502
---
M includes/api/ApiQueryRecentChanges.php
1 file changed, 13 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/45/91845/1

diff --git a/includes/api/ApiQueryRecentChanges.php 
b/includes/api/ApiQueryRecentChanges.php
index 13100ef..dc47cf3 100644
--- a/includes/api/ApiQueryRecentChanges.php
+++ b/includes/api/ApiQueryRecentChanges.php
@@ -191,6 +191,7 @@
|| ( isset( $show['anon'] )  isset( 
$show['!anon'] ) )
|| ( isset( $show['redirect'] )  
isset( $show['!redirect'] ) )
|| ( isset( $show['patrolled'] )  
isset( $show['!patrolled'] ) )
+   || ( isset( $show['patrolled'] )  
isset( $show['unpatrolled'] ) )
) {
$this-dieUsageMsg( 'show' );
}
@@ -212,6 +213,16 @@
$this-addWhereIf( 'rc_patrolled = 0', isset( 
$show['!patrolled'] ) );
$this-addWhereIf( 'rc_patrolled != 0', isset( 
$show['patrolled'] ) );
$this-addWhereIf( 'page_is_redirect = 1', isset( 
$show['redirect'] ) );
+
+   if ( isset( $show['unpatrolled'] ) ) {
+   // See ChangesList:isUnpatrolled
+   if ( $user-useRCPatrol() ) {
+   $this-addWhere('rc_patrolled = 0');
+   } elseif ( $user-useNPPatrol() ) {
+   $this-addWhere('rc_patrolled = 0');
+   $this-addWhereFld('rc_type', RC_NEW);
+   }
+   }
 
// Don't throw log entries out the window here
$this-addWhereIf( 'page_is_redirect = 0 OR 
page_is_redirect IS NULL', isset( $show['!redirect'] ) );
@@ -614,7 +625,8 @@
'redirect',
'!redirect',
'patrolled',
-   '!patrolled'
+   '!patrolled',
+   'unpatrolled'
)
),
'limit' = array(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I356a8625c7126b90aa7e7a23efe3bef7d448b502
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle krinklem...@gmail.com

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