jenkins-bot has submitted this change and it was merged.
Change subject: (bug 25325) fix hiding bot edits
......................................................................
(bug 25325) fix hiding bot edits
I added support for 'wlshow' parameter, which allows user
to decide if to include or exclude bot/minor/anon/patrolled
edits from feed watchlist.
Plus: I bound the params checkup and params' descriptions with
ApiQueryWatchlist (Yurik's suggestions).
Change-Id: Idab489fc017dcf226ea39f2f1766e06064e4ec0a
---
M includes/api/ApiFeedWatchlist.php
1 file changed, 38 insertions(+), 19 deletions(-)
Approvals:
Yurik: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/api/ApiFeedWatchlist.php
b/includes/api/ApiFeedWatchlist.php
index 6c793b3..fdbdcc3 100644
--- a/includes/api/ApiFeedWatchlist.php
+++ b/includes/api/ApiFeedWatchlist.php
@@ -33,6 +33,9 @@
*/
class ApiFeedWatchlist extends ApiBase {
+ private $linkToDiffs = false;
+ private $watchlistModule = null;
+
/**
* This module uses a custom feed wrapper printer.
*
@@ -41,8 +44,6 @@
public function getCustomPrinter() {
return new ApiFormatFeedWrapper( $this->getMain() );
}
-
- private $linkToDiffs = false;
/**
* Make a nested call to the API to request watchlist items in the last
$hours.
@@ -85,6 +86,9 @@
}
if ( $params['wlexcludeuser'] !== null ) {
$fauxReqArr['wlexcludeuser'] =
$params['wlexcludeuser'];
+ }
+ if ( $params['wlshow'] !== null ) {
+ $fauxReqArr['wlshow'] = $params['wlshow'];
}
// Support linking to diffs instead of article
@@ -168,10 +172,18 @@
return new FeedItem( $titleStr, $completeText, $titleUrl,
$timestamp, $user );
}
- public function getAllowedParams() {
+ private function getWatchlistModule() {
+ if ( $this->watchlistModule === null ) {
+ $this->watchlistModule =
$this->getMain()->getModuleManager()->getModule( 'query' )
+ ->getModuleManager()->getModule( 'watchlist' );
+ }
+ return $this->watchlistModule;
+ }
+
+ public function getAllowedParams( $flags = 0 ) {
global $wgFeedClasses;
$feedFormatNames = array_keys( $wgFeedClasses );
- return array (
+ $ret = array(
'feedformat' => array(
ApiBase::PARAM_DFLT => 'rss',
ApiBase::PARAM_TYPE => $feedFormatNames
@@ -182,29 +194,36 @@
ApiBase::PARAM_MIN => 1,
ApiBase::PARAM_MAX => 72,
),
- 'allrev' => false,
- 'wlowner' => array(
- ApiBase::PARAM_TYPE => 'user'
- ),
- 'wltoken' => array(
- ApiBase::PARAM_TYPE => 'string'
- ),
- 'wlexcludeuser' => array(
- ApiBase::PARAM_TYPE => 'user'
- ),
'linktodiffs' => false,
);
+ if ( $flags ) {
+ $wlparams =
$this->getWatchlistModule()->getAllowedParams( $flags );
+ $ret['allrev'] = $wlparams['allrev'];
+ $ret['wlowner'] = $wlparams['owner'];
+ $ret['wltoken'] = $wlparams['token'];
+ $ret['wlshow'] = $wlparams['show'];
+ $ret['wlexcludeuser'] = $wlparams['excludeuser'];
+ } else {
+ $ret['allrev'] = null;
+ $ret['wlowner'] = null;
+ $ret['wltoken'] = null;
+ $ret['wlshow'] = null;
+ $ret['wlexcludeuser'] = null;
+ }
+ return $ret;
}
public function getParamDescription() {
+ $wldescr = $this->getWatchlistModule()->getParamDescription();
return array(
'feedformat' => 'The format of the feed',
- 'hours' => 'List pages modified within this many
hours from now',
- 'allrev' => 'Include multiple revisions of the same
page within given timeframe',
- 'wlowner' => "The user whose watchlist you want
(must be accompanied by {$this->getModulePrefix()}wltoken if it's not you)",
- 'wltoken' => 'Security token that requested user set
in their preferences',
- 'wlexcludeuser' => 'A user whose edits should not be
shown in the watchlist',
+ 'hours' => 'List pages modified within this many hours
from now',
'linktodiffs' => 'Link to change differences instead of
article pages',
+ 'allrev' => $wldescr['allrev'],
+ 'wlowner' => $wldescr['owner'],
+ 'wltoken' => $wldescr['token'],
+ 'wlshow' => $wldescr['show'],
+ 'wlexcludeuser' => $wldescr['excludeuser'],
);
}
--
To view, visit https://gerrit.wikimedia.org/r/54654
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idab489fc017dcf226ea39f2f1766e06064e4ec0a
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Kaligula <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Kaligula <[email protected]>
Gerrit-Reviewer: Matmarex <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits