Parent5446 has uploaded a new change for review.

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

Change subject: Added more filter options to $wgRCFeeds
......................................................................

Added more filter options to $wgRCFeeds

Changed RecentChange::notifyRCFeeds() to allow more
filter options than just omit_bots. In order to mirror
the on-wiki Special:RecentChanges UI, the options
omit_anon, omit_user, omit_minor, omit_patrolled were added,
which omits anonymous, registered, minor, and patrolled
edits, respectively.

Bug: 60941
Change-Id: I716c741f1f7d42b6506a97e9a5733beac23ac16c
---
M includes/DefaultSettings.php
M includes/changes/RecentChange.php
2 files changed, 18 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/36/111736/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index d0ceafc..70862a4 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -5577,6 +5577,10 @@
  *   * 'formatter' -- the class name (implementing RCFeedFormatter) which will
  *     produce the text to send.
  *   * 'omit_bots' -- whether the bot edits should be in the feed
+ *   * 'omit_anon' -- whether anonymous edits should be in the feed
+ *   * 'omit_user' -- whether edits by registered users should be in the feed
+ *   * 'omit_minor' -- whether minor edits should be in the feed
+ *   * 'omit_patrolled' -- whether patrolled edits should be in the feed
  *  The IRC-specific options are:
  *   * 'add_interwiki_prefix' -- whether the titles should be prefixed with
  *     $wgLocalInterwiki.
diff --git a/includes/changes/RecentChange.php 
b/includes/changes/RecentChange.php
index 01ad724..bb23ec9 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -333,11 +333,23 @@
        public function notifyRCFeeds() {
                global $wgRCFeeds;
 
+               $performer = $this->getPerformer();
+
                foreach ( $wgRCFeeds as $feed ) {
-                       $omitBots = isset( $feed['omit_bots'] ) ? 
$feed['omit_bots'] : false;
+                       $feed += array(
+                               'omit_bots' => false,
+                               'omit_anon' => false,
+                               'omit_user' => false,
+                               'omit_minor' => false,
+                               'omit_patrolled' => false,
+                       );
 
                        if (
-                               ( $omitBots && $this->mAttribs['rc_bot'] ) ||
+                               ( $feed['omit_bots'] && 
$this->mAttribs['rc_bot'] ) ||
+                               ( $feed['omit_anon'] && $performer->isAnon() ) 
||
+                               ( $feed['omit_user'] && !$performer->isAnon() ) 
||
+                               ( $feed['omit_minor'] && 
$this->mAttribs['rc_minor'] ) ||
+                               ( $feed['omit_patrolled'] && 
$this->mAttribs['rc_patrolled'] ) ||
                                $this->mAttribs['rc_type'] == RC_EXTERNAL
                        ) {
                                continue;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I716c741f1f7d42b6506a97e9a5733beac23ac16c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Parent5446 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to