jenkins-bot has submitted this change and it was merged.
Change subject: Special:RC filter: hideunpatrolled
......................................................................
Special:RC filter: hideunpatrolled
Allows hiding edits that have not been patrolled.
In other words, showing only edits that have been patrolled.
Will be used by the new Special:RC filters (ERI project).
Bug: T152061
Change-Id: I3cd896812c5af87bc4be53d493055c37298c712f
---
M includes/specialpage/ChangesListSpecialPage.php
M tests/phpunit/includes/specials/SpecialRecentchangesTest.php
2 files changed, 101 insertions(+), 13 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/specialpage/ChangesListSpecialPage.php
b/includes/specialpage/ChangesListSpecialPage.php
index 5add448..2051948 100644
--- a/includes/specialpage/ChangesListSpecialPage.php
+++ b/includes/specialpage/ChangesListSpecialPage.php
@@ -145,6 +145,7 @@
$opts->add( 'hideanons', false );
$opts->add( 'hideliu', false );
$opts->add( 'hidepatrolled', false );
+ $opts->add( 'hideunpatrolled', false );
$opts->add( 'hidemyself', false );
$opts->add( 'hidebyothers', false );
@@ -242,8 +243,13 @@
if ( $opts['hidehumans'] ) {
$conds[] = 'rc_bot = 1';
}
- if ( $user->useRCPatrol() && $opts['hidepatrolled'] ) {
- $conds['rc_patrolled'] = 0;
+ if ( $user->useRCPatrol() ) {
+ if ( $opts['hidepatrolled'] ) {
+ $conds[] = 'rc_patrolled = 0';
+ }
+ if ( $opts['hideunpatrolled'] ) {
+ $conds[] = 'rc_patrolled = 1';
+ }
}
if ( $botsonly ) {
$conds['rc_bot'] = 1;
diff --git a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
index 0cd1b34..03e9c8f 100644
--- a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
+++ b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
@@ -153,8 +153,8 @@
$this->assertConditions(
[ # expected
'rc_bot' => 0,
- 0 => "rc_user != '{$user->getId()}'",
- 1 => "rc_type != '6'",
+ "rc_user != '{$user->getId()}'",
+ "rc_type != '6'",
],
[
'hidemyself' => 1,
@@ -167,8 +167,8 @@
$this->assertConditions(
[ # expected
'rc_bot' => 0,
- 0 => "rc_user_text != '10.11.12.13'",
- 1 => "rc_type != '6'",
+ "rc_user_text != '10.11.12.13'",
+ "rc_type != '6'",
],
[
'hidemyself' => 1,
@@ -183,8 +183,8 @@
$this->assertConditions(
[ # expected
'rc_bot' => 0,
- 0 => "rc_user = '{$user->getId()}'",
- 1 => "rc_type != '6'",
+ "rc_user = '{$user->getId()}'",
+ "rc_type != '6'",
],
[
'hidebyothers' => 1,
@@ -197,8 +197,8 @@
$this->assertConditions(
[ # expected
'rc_bot' => 0,
- 0 => "rc_user_text = '10.11.12.13'",
- 1 => "rc_type != '6'",
+ "rc_user_text = '10.11.12.13'",
+ "rc_type != '6'",
],
[
'hidebyothers' => 1,
@@ -213,9 +213,9 @@
$this->assertConditions(
[ # expected
'rc_bot' => 0,
- 0 => "rc_user != '{$user->getId()}'",
- 1 => "rc_user = '{$user->getId()}'",
- 2 => "rc_type != '6'",
+ "rc_user != '{$user->getId()}'",
+ "rc_user = '{$user->getId()}'",
+ "rc_type != '6'",
],
[
'hidemyself' => 1,
@@ -281,4 +281,86 @@
"rc conditions: hidebots=0 hidehumans=1"
);
}
+
+ public function testRcHidepatrolledDisabledFilter() {
+ $user = $this->getTestUser()->getUser();
+ $this->assertConditions(
+ [ # expected
+ 'rc_bot' => 0,
+ "rc_type != '6'",
+ ],
+ [
+ 'hidepatrolled' => 1,
+ ],
+ "rc conditions: hidepatrolled=1 (user not allowed)",
+ $user
+ );
+ }
+
+ public function testRcHideunpatrolledDisabledFilter() {
+ $user = $this->getTestUser()->getUser();
+ $this->assertConditions(
+ [ # expected
+ 'rc_bot' => 0,
+ "rc_type != '6'",
+ ],
+ [
+ 'hideunpatrolled' => 1,
+ ],
+ "rc conditions: hideunpatrolled=1 (user not allowed)",
+ $user
+ );
+ }
+ public function testRcHidepatrolledFilter() {
+ $user = $this->getTestSysop()->getUser();
+ $this->assertConditions(
+ [ # expected
+ 'rc_bot' => 0,
+ "rc_patrolled = 0",
+ "rc_type != '6'",
+ ],
+ [
+ 'hidepatrolled' => 1,
+ ],
+ "rc conditions: hidepatrolled=1",
+ $user
+ );
+ }
+
+ public function testRcHideunpatrolledFilter() {
+ $user = $this->getTestSysop()->getUser();
+ $this->assertConditions(
+ [ # expected
+ 'rc_bot' => 0,
+ "rc_patrolled = 1",
+ "rc_type != '6'",
+ ],
+ [
+ 'hideunpatrolled' => 1,
+ ],
+ "rc conditions: hideunpatrolled=1",
+ $user
+ );
+ }
+
+ // This is probably going to change when we do auto-fix of
+ // filters combinations that don't make sense but for now
+ // it's the behavior therefore it's the test.
+ public function testRcHidepatrolledHideunpatrolledFilter() {
+ $user = $this->getTestSysop()->getUser();
+ $this->assertConditions(
+ [ # expected
+ 'rc_bot' => 0,
+ "rc_patrolled = 0",
+ "rc_patrolled = 1",
+ "rc_type != '6'",
+ ],
+ [
+ 'hidepatrolled' => 1,
+ 'hideunpatrolled' => 1,
+ ],
+ "rc conditions: hidepatrolled=1 hideunpatrolled=1",
+ $user
+ );
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/324784
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3cd896812c5af87bc4be53d493055c37298c712f
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Sbisson <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits