From: Roan Kattouw Date: Tue, 28 Oct 2008 14:20:29 +0000 (+0000) Subject: API: * (bug 16159) Add wlshow=patrolled|!patrolled to list=watchlist X-Git-Tag: 1.31.0-rc.0~44536 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=5a18b6aa4e7e49e3733fcfb2e4987f7b7dbedd52;p=lhc%2Fweb%2Fwiklou.git API: * (bug 16159) Add wlshow=patrolled|!patrolled to list=watchlist * Followup of r42077: fix bug 15945 (use User::useRCPatrol() and useNPPatrol() rather than isAllowed('patrol')) for list=watchlist as well --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8726f6565d..977f8c1f4c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -374,6 +374,7 @@ The following extensions are migrated into MediaWiki 1.14: an error * (bug 16105) Image metadata attributes containing spaces result in invalid XML * (bug 16126) Added siprop=magicwords to meta=siteinfo +* (bug 16159) Added wlshow=patrolled|!patrolled to list=watchlist === Languages updated in 1.14 === diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index ca63347b8e..a70ea49730 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -76,8 +76,8 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->fld_patrol = isset($prop['patrol']); if ($this->fld_patrol) { - global $wgUseRCPatrol, $wgUser; - if (!$wgUseRCPatrol || !$wgUser->isAllowed('patrol')) + global $wgUser; + if (!$wgUser->useRCPatrol() && !$wgUser->useNPPatrol()) $this->dieUsage('patrol property is not available', 'patrol'); } } @@ -141,10 +141,16 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { /* Check for conflicting parameters. */ if ((isset ($show['minor']) && isset ($show['!minor'])) || (isset ($show['bot']) && isset ($show['!bot'])) - || (isset ($show['anon']) && isset ($show['!anon']))) { + || (isset ($show['anon']) && isset ($show['!anon'])) + || (isset ($show['patrolled']) && isset ($show['!patrolled']))) { $this->dieUsage("Incorrect parameter - mutually exclusive values may not be supplied", 'show'); } + + // Check permissions + global $wgUser; + if((isset($show['patrolled']) || isset($show['!patrolled'])) && !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol()) + $this->dieUsage("You need the patrol right to request the patrolled flag", 'permissiondenied'); /* Add additional conditions to query depending upon parameters. */ $this->addWhereIf('rc_minor = 0', isset ($show['!minor'])); @@ -153,6 +159,8 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->addWhereIf('rc_bot != 0', isset ($show['bot'])); $this->addWhereIf('rc_user = 0', isset ($show['anon'])); $this->addWhereIf('rc_user != 0', isset ($show['!anon'])); + $this->addWhereIf('rc_patrolled = 0', isset($show['!patrolled'])); + $this->addWhereIf('rc_patrolled != 0', isset($show['patrolled'])); } @@ -292,7 +300,9 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { 'bot', '!bot', 'anon', - '!anon' + '!anon', + 'patrolled', + '!patrolled', ) ) );